

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::ECR::Repository
<a name="aws-resource-ecr-repository"></a>

The `AWS::ECR::Repository` resource specifies an Amazon Elastic Container Registry (Amazon ECR) repository, where users can push and pull Docker images, Open Container Initiative (OCI) images, and OCI compatible artifacts. For more information, see [Amazon ECR private repositories](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html) in the *Amazon ECR User Guide*.

## Syntax
<a name="aws-resource-ecr-repository-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-ecr-repository-syntax.json"></a>

```
{
  "Type" : "AWS::ECR::Repository",
  "Properties" : {
      "[EmptyOnDelete](#cfn-ecr-repository-emptyondelete)" : Boolean,
      "[EncryptionConfiguration](#cfn-ecr-repository-encryptionconfiguration)" : EncryptionConfiguration,
      "[ImageScanningConfiguration](#cfn-ecr-repository-imagescanningconfiguration)" : ImageScanningConfiguration,
      "[ImageTagMutability](#cfn-ecr-repository-imagetagmutability)" : String,
      "[ImageTagMutabilityExclusionFilters](#cfn-ecr-repository-imagetagmutabilityexclusionfilters)" : [ ImageTagMutabilityExclusionFilter, ... ],
      "[LifecyclePolicy](#cfn-ecr-repository-lifecyclepolicy)" : LifecyclePolicy,
      "[RepositoryName](#cfn-ecr-repository-repositoryname)" : String,
      "[RepositoryPolicyText](#cfn-ecr-repository-repositorypolicytext)" : Json,
      "[Tags](#cfn-ecr-repository-tags)" : [ Tag, ... ]
    }
}
```

### YAML
<a name="aws-resource-ecr-repository-syntax.yaml"></a>

```
Type: AWS::ECR::Repository
Properties:
  [EmptyOnDelete](#cfn-ecr-repository-emptyondelete): Boolean
  [EncryptionConfiguration](#cfn-ecr-repository-encryptionconfiguration): 
    EncryptionConfiguration
  [ImageScanningConfiguration](#cfn-ecr-repository-imagescanningconfiguration): 
    ImageScanningConfiguration
  [ImageTagMutability](#cfn-ecr-repository-imagetagmutability): String
  [ImageTagMutabilityExclusionFilters](#cfn-ecr-repository-imagetagmutabilityexclusionfilters): 
    - ImageTagMutabilityExclusionFilter
  [LifecyclePolicy](#cfn-ecr-repository-lifecyclepolicy): 
    LifecyclePolicy
  [RepositoryName](#cfn-ecr-repository-repositoryname): String
  [RepositoryPolicyText](#cfn-ecr-repository-repositorypolicytext): Json
  [Tags](#cfn-ecr-repository-tags): 
    - Tag
```

## Properties
<a name="aws-resource-ecr-repository-properties"></a>

`EmptyOnDelete`  <a name="cfn-ecr-repository-emptyondelete"></a>
If true, deleting the repository force deletes the contents of the repository. If false, the repository must be empty before attempting to delete it.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`EncryptionConfiguration`  <a name="cfn-ecr-repository-encryptionconfiguration"></a>
The encryption configuration for the repository. This determines how the contents of your repository are encrypted at rest.  
*Required*: No  
*Type*: [EncryptionConfiguration](aws-properties-ecr-repository-encryptionconfiguration.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ImageScanningConfiguration`  <a name="cfn-ecr-repository-imagescanningconfiguration"></a>
The `imageScanningConfiguration` parameter is being deprecated, in favor of specifying the image scanning configuration at the registry level. For more information, see `PutRegistryScanningConfiguration`.
The image scanning configuration for the repository. This determines whether images are scanned for known vulnerabilities after being pushed to the repository.  
*Required*: No  
*Type*: [ImageScanningConfiguration](aws-properties-ecr-repository-imagescanningconfiguration.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ImageTagMutability`  <a name="cfn-ecr-repository-imagetagmutability"></a>
The tag mutability setting for the repository. If this parameter is omitted, the default setting of `MUTABLE` will be used which will allow image tags to be overwritten. If `IMMUTABLE` is specified, all image tags within the repository will be immutable which will prevent them from being overwritten.  
*Required*: No  
*Type*: String  
*Allowed values*: `MUTABLE | IMMUTABLE | MUTABLE_WITH_EXCLUSION | IMMUTABLE_WITH_EXCLUSION`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ImageTagMutabilityExclusionFilters`  <a name="cfn-ecr-repository-imagetagmutabilityexclusionfilters"></a>
A list of filters that specify which image tags are excluded from the repository's image tag mutability setting.  
*Required*: No  
*Type*: Array of [ImageTagMutabilityExclusionFilter](aws-properties-ecr-repository-imagetagmutabilityexclusionfilter.md)  
*Minimum*: `1`  
*Maximum*: `5`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`LifecyclePolicy`  <a name="cfn-ecr-repository-lifecyclepolicy"></a>
Creates or updates a lifecycle policy. For information about lifecycle policy syntax, see [Lifecycle policy template](https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html).  
*Required*: No  
*Type*: [LifecyclePolicy](aws-properties-ecr-repository-lifecyclepolicy.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`RepositoryName`  <a name="cfn-ecr-repository-repositoryname"></a>
The name to use for the repository. The repository name may be specified on its own (such as `nginx-web-app`) or it can be prepended with a namespace to group the repository into a category (such as `project-a/nginx-web-app`). If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the repository name. For more information, see [Name type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html).  
The repository name must start with a letter and can only contain lowercase letters, numbers, hyphens, underscores, and forward slashes.  
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
*Required*: No  
*Type*: String  
*Pattern*: `^(?=.{2,256}$)([a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(\/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*)$`  
*Minimum*: `2`  
*Maximum*: `256`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`RepositoryPolicyText`  <a name="cfn-ecr-repository-repositorypolicytext"></a>
The JSON repository policy text to apply to the repository. For more information, see [Amazon ECR repository policies](https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html) in the *Amazon Elastic Container Registry User Guide*.  
*Required*: No  
*Type*: Json  
*Minimum*: `0`  
*Maximum*: `10240`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Tags`  <a name="cfn-ecr-repository-tags"></a>
An array of key-value pairs to apply to this resource.  
*Required*: No  
*Type*: Array of [Tag](aws-properties-ecr-repository-tag.md)  
*Maximum*: `50`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-ecr-repository-return-values"></a>

### Ref
<a name="aws-resource-ecr-repository-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the resource name, such as `test-repository`.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-ecr-repository-return-values-fn--getatt"></a>

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-ecr-repository-return-values-fn--getatt-fn--getatt"></a>

`Arn`  <a name="Arn-fn::getatt"></a>
Returns the Amazon Resource Name (ARN) for the specified `AWS::ECR::Repository` resource. For example, `arn:aws:ecr:eu-west-1:123456789012:repository/test-repository`.

`RepositoryUri`  <a name="RepositoryUri-fn::getatt"></a>
Returns the URI for the specified `AWS::ECR::Repository` resource. For example, `123456789012.dkr.ecr.us-west-2.amazonaws.com/repository`.

## Examples
<a name="aws-resource-ecr-repository--examples"></a>



**Topics**
+ [Specify a repository](#aws-resource-ecr-repository--examples--Specify_a_repository)
+ [Specify a repository with an image scanning configuration](#aws-resource-ecr-repository--examples--Specify_a_repository_with_an_image_scanning_configuration)
+ [Specify a repository with a lifecycle policy](#aws-resource-ecr-repository--examples--Specify_a_repository_with_a_lifecycle_policy)

### Specify a repository
<a name="aws-resource-ecr-repository--examples--Specify_a_repository"></a>

The following example specifies a repository named `test-repository`. Its policy permits the users `Bob` and `Alice` to push and pull images. Note that the IAM users actually need to exist, or stack creation will fail.

#### JSON
<a name="aws-resource-ecr-repository--examples--Specify_a_repository--json"></a>

```
"MyRepository": {
  "Type": "AWS::ECR::Repository",
  "Properties": {
    "RepositoryName" : "test-repository",
    "RepositoryPolicyText" : {
      "Version": "2012-10-17",		 	 	 
      "Statement": [
        {
          "Sid": "AllowPushPull",
          "Effect": "Allow",
          "Principal": {
            "AWS": [
              "arn:aws:iam::123456789012:user/Bob",
              "arn:aws:iam::123456789012:user/Alice"
            ]
          },
          "Action": [
            "ecr:GetDownloadUrlForLayer",
            "ecr:BatchGetImage",
            "ecr:BatchCheckLayerAvailability",
            "ecr:PutImage",
            "ecr:InitiateLayerUpload",
            "ecr:UploadLayerPart",
            "ecr:CompleteLayerUpload"
          ]
        }
      ]
    }
  }
}
```

#### YAML
<a name="aws-resource-ecr-repository--examples--Specify_a_repository--yaml"></a>

```
MyRepository: 
  Type: AWS::ECR::Repository
  Properties: 
    RepositoryName: "test-repository"
    RepositoryPolicyText: 
      Version: "2012-10-17"		 	 	 
      Statement: 
        - 
          Sid: AllowPushPull
          Effect: Allow
          Principal: 
            AWS: 
              - "arn:aws:iam::123456789012:user/Bob"
              - "arn:aws:iam::123456789012:user/Alice"
          Action: 
            - "ecr:GetDownloadUrlForLayer"
            - "ecr:BatchGetImage"
            - "ecr:BatchCheckLayerAvailability"
            - "ecr:PutImage"
            - "ecr:InitiateLayerUpload"
            - "ecr:UploadLayerPart"
            - "ecr:CompleteLayerUpload"
```

### Specify a repository with an image scanning configuration
<a name="aws-resource-ecr-repository--examples--Specify_a_repository_with_an_image_scanning_configuration"></a>

The following example creates a repository named `test-repository` with image scanning enabled. For more information on image scanning, see [Image scanning](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) in the *Amazon ECR User Guide*.

#### JSON
<a name="aws-resource-ecr-repository--examples--Specify_a_repository_with_an_image_scanning_configuration--json"></a>

```
"MyRepository": {
  "Type": "AWS::ECR::Repository",
  "Properties": {
    "RepositoryName" : "test-repository",
    "ImageScanningConfiguration" : {
      "ScanOnPush": true
    }
  }
}
```

#### YAML
<a name="aws-resource-ecr-repository--examples--Specify_a_repository_with_an_image_scanning_configuration--yaml"></a>

```
MyRepository: 
  Type: AWS::ECR::Repository
  Properties: 
    RepositoryName: "test-repository"
    ImageScanningConfiguration: 
      ScanOnPush: true
```

### Specify a repository with a lifecycle policy
<a name="aws-resource-ecr-repository--examples--Specify_a_repository_with_a_lifecycle_policy"></a>

The following example creates a repository with a lifecycle policy.

#### JSON
<a name="aws-resource-ecr-repository--examples--Specify_a_repository_with_a_lifecycle_policy--json"></a>

```
{
  "Parameters": {
    "lifecyclePolicyText": {
      "Type": "String"
    },
    "repositoryName": {
      "Type": "String"
    },
    "registryId": {
      "Type": "String"
    }
  },
  "Resources": {
    "MyRepository": {
      "Type": "AWS::ECR::Repository",
      "Properties": {
        "LifecyclePolicy": {
          "LifecyclePolicyText": {
            "Ref": "lifecyclePolicyText"
          },
          "RegistryId": {
            "Ref": "registryId"
          }
        },
        "RepositoryName": {
          "Ref": "repositoryName"
        }
      }
    }
  },
  "Outputs": {
    "Arn": {
      "Value": {
        "Fn::GetAtt": [
          "MyRepository",
          "Arn"
        ]
      }
    }
  }
}
```

#### YAML
<a name="aws-resource-ecr-repository--examples--Specify_a_repository_with_a_lifecycle_policy--yaml"></a>

```
Parameters:    
  lifecyclePolicyText:
    Type: String
  repositoryName:
    Type: String
  registryId:
    Type: String
Resources:
  MyRepository:
    Type: AWS::ECR::Repository
    Properties:
      LifecyclePolicy:
        LifecyclePolicyText: !Ref lifecyclePolicyText
        RegistryId: !Ref registryId
      RepositoryName: !Ref repositoryName
Outputs:    
  Arn:
    Value: !GetAtt MyRepository.Arn
```

## See also
<a name="aws-resource-ecr-repository--seealso"></a>
+ [Creating a lifecycle policy](https://docs.aws.amazon.com/AmazonECR/latest/userguide/lp_creation.html) in the *Amazon ECR User Guide*
+ [PutLifecyclePolicy](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_PutLifecyclePolicy.html) in the *Amazon ECR API Reference*



# AWS::ECR::Repository EncryptionConfiguration
<a name="aws-properties-ecr-repository-encryptionconfiguration"></a>

The encryption configuration for the repository. This determines how the contents of your repository are encrypted at rest.

By default, when no encryption configuration is set or the `AES256` encryption type is used, Amazon ECR uses server-side encryption with Amazon S3-managed encryption keys which encrypts your data at rest using an AES256 encryption algorithm. This does not require any action on your part.

For more control over the encryption of the contents of your repository, you can use server-side encryption with AWS Key Management Service key stored in AWS Key Management Service (AWS KMS) to encrypt your images. For more information, see [Amazon ECR encryption at rest](https://docs.aws.amazon.com/AmazonECR/latest/userguide/encryption-at-rest.html) in the *Amazon Elastic Container Registry User Guide*.

## Syntax
<a name="aws-properties-ecr-repository-encryptionconfiguration-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-ecr-repository-encryptionconfiguration-syntax.json"></a>

```
{
  "[EncryptionType](#cfn-ecr-repository-encryptionconfiguration-encryptiontype)" : String,
  "[KmsKey](#cfn-ecr-repository-encryptionconfiguration-kmskey)" : String
}
```

### YAML
<a name="aws-properties-ecr-repository-encryptionconfiguration-syntax.yaml"></a>

```
  [EncryptionType](#cfn-ecr-repository-encryptionconfiguration-encryptiontype): String
  [KmsKey](#cfn-ecr-repository-encryptionconfiguration-kmskey): String
```

## Properties
<a name="aws-properties-ecr-repository-encryptionconfiguration-properties"></a>

`EncryptionType`  <a name="cfn-ecr-repository-encryptionconfiguration-encryptiontype"></a>
The encryption type to use.  
If you use the `KMS` encryption type, the contents of the repository will be encrypted using server-side encryption with AWS Key Management Service key stored in AWS KMS. When you use AWS KMS to encrypt your data, you can either use the default AWS managed AWS KMS key for Amazon ECR, or specify your own AWS KMS key, which you already created.  
If you use the `KMS_DSSE` encryption type, the contents of the repository will be encrypted with two layers of encryption using server-side encryption with the AWS KMS Management Service key stored in AWS KMS. Similar to the `KMS` encryption type, you can either use the default AWS managed AWS KMS key for Amazon ECR, or specify your own AWS KMS key, which you've already created.   
If you use the `AES256` encryption type, Amazon ECR uses server-side encryption with Amazon S3-managed encryption keys which encrypts the images in the repository using an AES256 encryption algorithm.  
For more information, see [Amazon ECR encryption at rest](https://docs.aws.amazon.com/AmazonECR/latest/userguide/encryption-at-rest.html) in the *Amazon Elastic Container Registry User Guide*.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `AES256 | KMS | KMS_DSSE`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`KmsKey`  <a name="cfn-ecr-repository-encryptionconfiguration-kmskey"></a>
If you use the `KMS` encryption type, specify the AWS KMS key to use for encryption. The alias, key ID, or full ARN of the AWS KMS key can be specified. The key must exist in the same Region as the repository. If no key is specified, the default AWS managed AWS KMS key for Amazon ECR will be used.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `2048`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

# AWS::ECR::Repository ImageScanningConfiguration
<a name="aws-properties-ecr-repository-imagescanningconfiguration"></a>

The image scanning configuration for a repository.

## Syntax
<a name="aws-properties-ecr-repository-imagescanningconfiguration-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-ecr-repository-imagescanningconfiguration-syntax.json"></a>

```
{
  "[ScanOnPush](#cfn-ecr-repository-imagescanningconfiguration-scanonpush)" : Boolean
}
```

### YAML
<a name="aws-properties-ecr-repository-imagescanningconfiguration-syntax.yaml"></a>

```
  [ScanOnPush](#cfn-ecr-repository-imagescanningconfiguration-scanonpush): Boolean
```

## Properties
<a name="aws-properties-ecr-repository-imagescanningconfiguration-properties"></a>

`ScanOnPush`  <a name="cfn-ecr-repository-imagescanningconfiguration-scanonpush"></a>
The setting that determines whether images are scanned after being pushed to a repository. If set to `true`, images will be scanned after being pushed. If this parameter is not specified, it will default to `false` and images will not be scanned unless a scan is manually started.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::ECR::Repository ImageTagMutabilityExclusionFilter
<a name="aws-properties-ecr-repository-imagetagmutabilityexclusionfilter"></a>

A filter that specifies which image tags should be excluded from the repository's image tag mutability setting.

## Syntax
<a name="aws-properties-ecr-repository-imagetagmutabilityexclusionfilter-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-ecr-repository-imagetagmutabilityexclusionfilter-syntax.json"></a>

```
{
  "[ImageTagMutabilityExclusionFilterType](#cfn-ecr-repository-imagetagmutabilityexclusionfilter-imagetagmutabilityexclusionfiltertype)" : String,
  "[ImageTagMutabilityExclusionFilterValue](#cfn-ecr-repository-imagetagmutabilityexclusionfilter-imagetagmutabilityexclusionfiltervalue)" : String
}
```

### YAML
<a name="aws-properties-ecr-repository-imagetagmutabilityexclusionfilter-syntax.yaml"></a>

```
  [ImageTagMutabilityExclusionFilterType](#cfn-ecr-repository-imagetagmutabilityexclusionfilter-imagetagmutabilityexclusionfiltertype): String
  [ImageTagMutabilityExclusionFilterValue](#cfn-ecr-repository-imagetagmutabilityexclusionfilter-imagetagmutabilityexclusionfiltervalue): String
```

## Properties
<a name="aws-properties-ecr-repository-imagetagmutabilityexclusionfilter-properties"></a>

`ImageTagMutabilityExclusionFilterType`  <a name="cfn-ecr-repository-imagetagmutabilityexclusionfilter-imagetagmutabilityexclusionfiltertype"></a>
Property description not available.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `WILDCARD`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ImageTagMutabilityExclusionFilterValue`  <a name="cfn-ecr-repository-imagetagmutabilityexclusionfilter-imagetagmutabilityexclusionfiltervalue"></a>
Property description not available.  
*Required*: Yes  
*Type*: String  
*Pattern*: `^[0-9a-zA-Z._*-]{1,128}`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::ECR::Repository LifecyclePolicy
<a name="aws-properties-ecr-repository-lifecyclepolicy"></a>

The `LifecyclePolicy` property type specifies a lifecycle policy. For information about lifecycle policy syntax, see [Lifecycle policy template](https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html) in the *Amazon ECR User Guide*.

## Syntax
<a name="aws-properties-ecr-repository-lifecyclepolicy-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-ecr-repository-lifecyclepolicy-syntax.json"></a>

```
{
  "[LifecyclePolicyText](#cfn-ecr-repository-lifecyclepolicy-lifecyclepolicytext)" : String,
  "[RegistryId](#cfn-ecr-repository-lifecyclepolicy-registryid)" : String
}
```

### YAML
<a name="aws-properties-ecr-repository-lifecyclepolicy-syntax.yaml"></a>

```
  [LifecyclePolicyText](#cfn-ecr-repository-lifecyclepolicy-lifecyclepolicytext): String
  [RegistryId](#cfn-ecr-repository-lifecyclepolicy-registryid): String
```

## Properties
<a name="aws-properties-ecr-repository-lifecyclepolicy-properties"></a>

`LifecyclePolicyText`  <a name="cfn-ecr-repository-lifecyclepolicy-lifecyclepolicytext"></a>
The JSON repository policy text to apply to the repository.  
*Required*: No  
*Type*: String  
*Minimum*: `100`  
*Maximum*: `30720`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`RegistryId`  <a name="cfn-ecr-repository-lifecyclepolicy-registryid"></a>
The AWS account ID associated with the registry that contains the repository. If you do  not specify a registry, the default registry is assumed.  
*Required*: No  
*Type*: String  
*Pattern*: `^[0-9]{12}$`  
*Minimum*: `12`  
*Maximum*: `12`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## See also
<a name="aws-properties-ecr-repository-lifecyclepolicy--seealso"></a>
+ [Creating a lifecycle policy](https://docs.aws.amazon.com/AmazonECR/latest/userguide/lp_creation.html) in the *Amazon ECR User Guide*
+ [PutLifecyclePolicy](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_PutLifecyclePolicy.html) in the *Amazon ECR API Reference*



# AWS::ECR::Repository Tag
<a name="aws-properties-ecr-repository-tag"></a>

The metadata to apply to a resource to help you categorize and organize them. Each tag consists of a key and a value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

## Syntax
<a name="aws-properties-ecr-repository-tag-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-ecr-repository-tag-syntax.json"></a>

```
{
  "[Key](#cfn-ecr-repository-tag-key)" : String,
  "[Value](#cfn-ecr-repository-tag-value)" : String
}
```

### YAML
<a name="aws-properties-ecr-repository-tag-syntax.yaml"></a>

```
  [Key](#cfn-ecr-repository-tag-key): String
  [Value](#cfn-ecr-repository-tag-value): String
```

## Properties
<a name="aws-properties-ecr-repository-tag-properties"></a>

`Key`  <a name="cfn-ecr-repository-tag-key"></a>
One part of a key-value pair that make up a tag. A `key` is a general label that acts like a category for more specific tag values.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `127`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-ecr-repository-tag-value"></a>
A `value` acts as a descriptor within a tag category (key).  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `255`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)