> For the complete documentation index, see [llms.txt](https://docs.codeocean.com/admin-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codeocean.com/admin-guide/deployment-guide/build-custom-ami.md).

# Build Custom AMI

Each version of Code Ocean VPC comes with a dedicated AMI that is specified in the CloudFormation template. However, in environments subject to strict AMI usage policies, you may need to build a custom AMI based on your company's preferred AMI or one that includes required additional tools and services.

The artifacts for the Code Ocean AMI are stored in the *codeocean-vpc* S3 bucket, bundled in a tar file. The installation process includes installing packages, drivers, and tools, deploying configuration files, and enabling the system services required for a functioning Code Ocean AMI.

The installation must be performed on a G4DN instance to allow installation of GPU drivers and packages required for GPU workers and batch machines.

## Installation

#### Amazon Linux 2023

1. Launch your desired Amazon Linux 2023 base AMI using a *g4dn.xlarge* instance type.
2. Download the Code Ocean AMI installation tar file into a new directory:

```
mkdir -p /tmp/codeocean-ami
aws s3 cp \
    s3://codeocean-vpc/templates/v4.0.0/ami/files.tar.gz \
    /tmp/codeocean-ami
```

2. Extract the tar file:

```
tar xzpf /tmp/codeocean-ami/files.tar.gz \
    -C /tmp/codeocean-ami
```

3. Install the Code Ocean AMI:

```
chmod +x /tmp/codeocean-ami/install.sh
/tmp/codeocean-ami/install.sh
```

4. Clean up the installation files:

```
rm -rf /tmp/codeocean-ami
```

## Deployment

Update your Code Ocean deployment and specify the new AMI ID under the [Custom AMI Configuration](/admin-guide/deployment-guide/deployment-parameters.md#custom-ami-configuration) section of the CloudFormation template.
