Use Amazon ECR images

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 and tag when starting the deployment.

$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

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.

# 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

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

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 for all the job options.

Was this page helpful?

What went wrong?

↑↓ Navigate↵ Open⌘↵ New tabesc Close