

# Private registry authentication for jobs
<a name="private-registry"></a>

Private registry authentication for jobs using Amazon Secrets Manager enables you to store your credentials securely and then reference them in your job definition. This provides a way to reference container images that exist in private registries outside of Amazon that require authentication in your job definitions. This feature is supported by jobs hosted on Amazon EC2 instances and Fargate.

**Important**  
If your job definition references an image that's stored in Amazon ECR, this topic doesn't apply. For more information, see [Using Amazon ECR Images with Amazon ECS](https://docs.amazonaws.cn/AmazonECR/latest/userguide/ECR_on_ECS.html) in the *Amazon Elastic Container Registry User Guide*.

For jobs hosted on Amazon EC2 instances, this feature requires version `1.19.0` or later of the container agent. However, we recommend using the latest container agent version. For information about how to check your agent version and update to the latest version, see [Updating the Amazon ECS container agent](https://docs.amazonaws.cn/AmazonECS/latest/developerguide/ecs-agent-update.html) in the *Amazon Elastic Container Service Developer Guide*.

For jobs hosted on Fargate, this feature requires platform version `1.2.0` or later. For information, see [Amazon Fargate Linux platform versions](https://docs.amazonaws.cn/AmazonECS/latest/developerguide/platform-linux-fargate.html) in the *Amazon Elastic Container Service Developer Guide*.

Within your container definition, specify the `repositoryCredentials` object with the details of the secret that you created. The secret you reference can be from a different Amazon Web Services Region or a different account than the job using it.

**Note**  
When using the Amazon Batch API, Amazon CLI, or Amazon SDK, if the secret exists in the same Amazon Web Services Region as the job that you're launching then you can use either the full ARN or name of the secret. If the secret exists in a different account, the full ARN of the secret must be specified. When using the Amazon Web Services Management Console, the full ARN of the secret must be specified always.

The following is a snippet of a job definition that shows the required parameters:

```
"containerProperties": [
  {
    "image": "{{private-repo/private-image}}",
    "repositoryCredentials": {
      "credentialsParameter": "arn:aws-cn:secretsmanager:{{region}}:{{123456789012}}:secret:{{secret_name}}"
    }
  }
]
```