---
title: Use Amazon ECR images
description: >-
  To deploy a private AWS ECR image, make sure the ECR is authorized to the AWS
  account you've connected to Lightning AI. Once that happens, use the name...
canonical: 'https://lightning.ai/docs/platform/build/container-images/aws-ecr'
---
# Use Amazon ECR images {#use-amazon-ecr-images}

To deploy a private [AWS ECR](https://aws.amazon.com/ecr/) image, make sure the ECR is authorized to the AWS account you've connected to Lightning AI. Once that happens, use the name and tag when starting the deployment.

```text
$AWS_ACCOUNT_ID.dkr.ecr.$LIGHTNING_CLUSTER_PRIMARY_REGION.amazonaws.com/litserve-model:latest
```

Note: Private AWS ECR deployments are only available on the enterprise tier when connected to your AWS account.

## Push and pull a test image {#push-and-pull-a-test-image}

To try the registry path, push a test image to your ECR and pull it back. Pushing uses your own AWS credentials, not the connected account. ECR repositories are private by default.

```bash
# create repository
aws ecr create-repository --repository-name nginx-test --region <region>
# login
aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <account>.dkr.ecr.<region>.amazonaws.com
# pull test image (or use your own)
docker pull nginx:latest
# tag
docker tag nginx:latest <account>.dkr.ecr.<region>.amazonaws.com/nginx-test:latest
# push
docker push <account>.dkr.ecr.<region>.amazonaws.com/nginx-test:latest
# pull
docker pull <account>.dkr.ecr.<region>.amazonaws.com/nginx-test:latest
```

Then use `<account>.dkr.ecr.<region>.amazonaws.com/nginx-test:latest` in a deployment or job.

## Use it in a job {#use-it-in-a-job}

Connect your AWS account, then pass `cloud_account_auth=True` so the job authenticates to ECR with it:

```python
from lightning_sdk import Job, Machine, Teamspace

teamspace = Teamspace(name="my-teamspace", user="my-user")

submitted_job = Job.run(
    name="my-job",
    command="python /scripts/train.py",
    image="<account>.dkr.ecr.<region>.amazonaws.com/litserve-model:latest",
    machine=Machine.CPU,
    teamspace=teamspace,
    cloud_account_auth=True,
)
```

See [Submit jobs](/docs/platform/inference/batch-jobs/submit-jobs.md) for all the job options.

---

**Navigation**

- Parent: [Use container images](/docs/platform/build/container-images.md)
