# Creating custom optimization packs

To create a custom optimization pack, the following fixed directory structure and several YAML manifests need to be created.

### Optimization pack directory structure <a href="#directory-structure" id="directory-structure"></a>

```
my_dir
|_ optimizationPack.yaml
|_ component-types
|  |_ componentType1.yaml
|
|_ metrics
|  |_ metricsGroup1.yaml
|
|_ parameters
|  |_ parametersGroup1.yaml
|
|_ telemetry-providers
|_ provider1.yaml
```

### Optimization pack manifest <a href="#optimization-pack-manifest" id="optimization-pack-manifest"></a>

The `optimizationPack.yaml` file is the manifest of the optimization pack to be created, which should always be named `optimizationPack` and have the following structure:

{% code lineNumbers="true" %}

```yaml
name: Java_8_Optimization_Pack
description: An optimization pack for the Java Hotspot JVM version 8
weight: 1
version: 1.0.0
tags:
- java
- jvm
```

{% endcode %}

where:

<table><thead><tr><th width="139">Field</th><th>Type</th><th width="198">Value restrictions</th><th>Is required</th><th width="150">Default value</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>It should not contain spaces.</td><td>TRUE</td><td><br><br></td><td>The name of the optimization pack.</td></tr><tr><td><code>description</code></td><td>string</td><td><br><br></td><td>TRUE</td><td><br><br></td><td>A description to characterize the optimization pack.</td></tr><tr><td><code>weight</code></td><td>integer</td><td>weight > 0</td><td>TRUE</td><td><br><br></td><td>A weight to be associated to the optimization pack. This field is used for licensing purposes.</td></tr><tr><td><code>version</code></td><td>string</td><td>It should match the regexp:<br><code>\d.\d.\d</code></td><td>TRUE</td><td><br><br></td><td>The version of the optimization pack.</td></tr><tr><td><code>tags</code></td><td>array of string</td><td><br><br></td><td>FALSE</td><td>An empty array</td><td>A set of tags to make the optimization pack more easily searchable and discoverable.</td></tr></tbody></table>

### Component types <a href="#component-types" id="component-types"></a>

The `component-types` directory should contain the manifests of the component types to be included in the optimization pack. No particular naming constraint is enforced on those manifests.

See [Component Types template](https://docs.akamas.io/akamas-docs/3.1.2/akamas-reference/construct-templates/component-types-template) for details on the structure of those manifests.

### Metrics <a href="#metrics" id="metrics"></a>

The `metrics` directory should contain the manifests of the groups of metrics to be included in the optimization pack. No particular naming constraint is enforced on those manifests.

See [Metric template](https://docs.akamas.io/akamas-docs/3.1.2/akamas-reference/construct-templates/metric-template) for details on the structure of those manifests.

### Parameters <a href="#parameters" id="parameters"></a>

The `parameters` directory should contain the manifests of the groups of parameters to be included in the optimization pack. No particular naming constraint is enforced on those manifests.

See [Parameter template](https://docs.akamas.io/akamas-docs/3.1.2/akamas-reference/construct-templates/parameter-template) for details on the structure of those manifests.

### Telemetry providers <a href="#telemetry-providers" id="telemetry-providers"></a>

The `telemetry-providers` directory should contain the manifests of the groups of parameters to be included in the optimization pack. No particular naming is enforced on those manifests.

See [Telemetry Provider template](https://docs.akamas.io/akamas-docs/3.1.2/akamas-reference/construct-templates/integrating-telemetry-providers) for details on the structure of those manifests.

## Building optimization pack descriptor <a href="#using-the-akamas-cli-to-build-the-final-optimization-pack-descriptor" id="using-the-akamas-cli-to-build-the-final-optimization-pack-descriptor"></a>

The following command need to be executed in order to produce the final JSON descriptor:

```bash
akamas build optimization-pack PATH_TO_THE_DIRECTORY
```

After this, the optimization pack can be installed (and then used) as described on the [Managing optimization packs](https://docs.akamas.io/akamas-docs/3.1.2/using-akamas/preparing-optimization-studies/modeling-components/installing-optimization-packs) page.
