AWS Amazon ECR Registry Policy
This page shows how to write Terraform and CloudFormation for Amazon ECR Registry Policy and write them securely.
aws_ecr_registry_policy (Terraform)
The Registry Policy in Amazon ECR can be configured in Terraform with the resource name aws_ecr_registry_policy
. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_ecr_registry_policy" "this" {
policy = var.policy
Parameters
-
id
optional computed - string -
policy
required - string -
registry_id
optional computed - string
Explanation in Terraform Registry
Provides an Elastic Container Registry Policy.
Tips: Best Practices for The Other AWS Amazon ECR Resources
In addition to the aws_ecr_repository, AWS Amazon ECR has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
aws_ecr_repository
Ensure to enable ECR image scan
It is better to enbale ECR image scan. AWS ECR provides a feature to scan container images and discover vulnerable software.
AWS::ECR::RegistryPolicy (CloudFormation)
The RegistryPolicy in ECR can be configured in CloudFormation with the resource name AWS::ECR::RegistryPolicy
. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
"AWS::ECR::RegistryPolicy": {
"Type": "AWS::ECR::RegistryPolicy",
"Properties": {}
},
"AWS::ApiGateway::Method": {
"Type": "AWS::ApiGateway::Method",
Parameters
-
PolicyText
required - Json
Explanation in CloudFormation Registry
The
AWS::ECR::RegistryPolicy
resource creates or updates the permissions policy for a private registry.A private registry policy is used to specify permissions for another AWS account and is used when configuring cross-account replication. For more information, see Registry permissions in the Amazon Elastic Container Registry User Guide.
Frequently asked questions
What is AWS Amazon ECR Registry Policy?
AWS Amazon ECR Registry Policy is a resource for Amazon ECR of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Amazon ECR Registry Policy?
For Terraform, the asaphe/terraform-aws-ecr source code example is useful. See the Terraform Example section for further details.
For CloudFormation, the mhlabs/aws-icons-directory source code example is useful. See the CloudFormation Example section for further details.