# AWS CodeBuild

The integration of Meterian with AWS CodeBuild is very simple and it requires just a couple of steps.

#### **New project**

From the CodeBuild Developer tools dashboard create a new project.&#x20;

Configure the build according according to your needs.

In the **Environment** section:

* Make sure your builds would get elevated privileges by selecting the checkbox right under "Privileged"

<figure><img src="https://3502151236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M-naNCUtT6Gw1tfDjRR%2Fuploads%2FQadD13x7vHVBlZt1TshC%2Fimage.png?alt=media&#x26;token=00903ea9-b49c-4ed9-87bd-8fbc29bba10b" alt=""><figcaption></figcaption></figure>

* Click "Additional configuration" at the bottom of the **Environment** section to be able to set environment variables, then set here the METERIAN\_API\_TOKEN variable.

<figure><img src="https://3502151236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M-naNCUtT6Gw1tfDjRR%2Fuploads%2F2wqaAOWV4RrZadoRDcoq%2Fimage.png?alt=media&#x26;token=a5bc49cd-52a5-4163-ba9e-9cfe281e7657" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3502151236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M-naNCUtT6Gw1tfDjRR%2Fuploads%2F5G8IcYJueX2uaTKfgQvM%2Fimage.png?alt=media&#x26;token=83ed9422-b57d-4fa3-9b19-b8305315d07a" alt=""><figcaption><p>Please consider using the "Secrets Manager" rather than the "Plaintext" option</p></figcaption></figure>

{% hint style="info" %}
To retrieve a Meterian API Token visit the [Meterian Dashboard](https://www.meterian.com/account); in your account select the tab "Tokens" and create a new one, or use an existing one.
{% endhint %}

In the **Buildspec** section you will need specify the buildspec file of your project or directly edit it in the web interface using "Insert build command" > "Switch to editor". \
Here's a full example using the Dockerized Client:

<pre><code>version: 0.2

phases:
  build:
    commands:
      - docker pull -q meterian/cli
      - docker run --rm --volume $(pwd):/workspace 
        --env METERIAN_API_TOKEN=$METERIAN_API_TOKEN meterian/cli 
<strong>
</strong></code></pre>

Now save and run your first build.&#x20;

If the base image you are using contains the build tools then you can also configure the buildspec to use the Thin Client, which will allow for faster builds. Here's a full example:

```
version: 0.2

phases:
  build:
    commands:
    - curl -s "https://www.meterian.io/downloads/meterian-cli.jar" -o meterian-cli.jar
    - java -jar meterian-cli.jar --report-console  
```

For an advanced use of the [Meterian Thin Client](https://docs.meterian.io/the-client/client) or [Meterian Dockerized Client](https://docs.meterian.io/the-client/the-meterian-client-dockerized) read the documentation.

{% hint style="info" %}
It is possible to specify more [client parameters](https://docs.meterian.io/the-client/command-line-parameters).
{% endhint %}

<br>
