1. Packages
  2. AWS Cloud Control
  3. API Docs
  4. ecr
  5. RegistryPolicy

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.26.0 published on Wednesday, Mar 12, 2025 by Pulumi

aws-native.ecr.RegistryPolicy

Explore with Pulumi AI

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.26.0 published on Wednesday, Mar 12, 2025 by Pulumi

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.

Example Usage

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var testRegistryPolicy = new AwsNative.Ecr.RegistryPolicy("testRegistryPolicy", new()
    {
        PolicyText = new Dictionary<string, object?>
        {
            ["version"] = "2012-10-17",
            ["statement"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["sid"] = "UpdatedRegistryPolicy",
                    ["effect"] = "Allow",
                    ["principal"] = new Dictionary<string, object?>
                    {
                        ["aws"] = "arn:aws:iam::210987654321:root",
                    },
                    ["action"] = new[]
                    {
                        "ecr:CreateRepository",
                        "ecr:ReplicateImage",
                    },
                    ["resource"] = "arn:aws:ecr:us-west-2:123456789012:repository/*",
                },
            },
        },
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/ecr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ecr.NewRegistryPolicy(ctx, "testRegistryPolicy", &ecr.RegistryPolicyArgs{
			PolicyText: pulumi.Any(map[string]interface{}{
				"version": "2012-10-17",
				"statement": []map[string]interface{}{
					map[string]interface{}{
						"sid":    "UpdatedRegistryPolicy",
						"effect": "Allow",
						"principal": map[string]interface{}{
							"aws": "arn:aws:iam::210987654321:root",
						},
						"action": []string{
							"ecr:CreateRepository",
							"ecr:ReplicateImage",
						},
						"resource": "arn:aws:ecr:us-west-2:123456789012:repository/*",
					},
				},
			}),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const testRegistryPolicy = new aws_native.ecr.RegistryPolicy("testRegistryPolicy", {policyText: {
    version: "2012-10-17",
    statement: [{
        sid: "UpdatedRegistryPolicy",
        effect: "Allow",
        principal: {
            aws: "arn:aws:iam::210987654321:root",
        },
        action: [
            "ecr:CreateRepository",
            "ecr:ReplicateImage",
        ],
        resource: "arn:aws:ecr:us-west-2:123456789012:repository/*",
    }],
}});
Copy
import pulumi
import pulumi_aws_native as aws_native

test_registry_policy = aws_native.ecr.RegistryPolicy("testRegistryPolicy", policy_text={
    "version": "2012-10-17",
    "statement": [{
        "sid": "UpdatedRegistryPolicy",
        "effect": "Allow",
        "principal": {
            "aws": "arn:aws:iam::210987654321:root",
        },
        "action": [
            "ecr:CreateRepository",
            "ecr:ReplicateImage",
        ],
        "resource": "arn:aws:ecr:us-west-2:123456789012:repository/*",
    }],
})
Copy

Coming soon!

Create RegistryPolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RegistryPolicy(name: string, args: RegistryPolicyArgs, opts?: CustomResourceOptions);
@overload
def RegistryPolicy(resource_name: str,
                   args: RegistryPolicyArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def RegistryPolicy(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   policy_text: Optional[Any] = None)
func NewRegistryPolicy(ctx *Context, name string, args RegistryPolicyArgs, opts ...ResourceOption) (*RegistryPolicy, error)
public RegistryPolicy(string name, RegistryPolicyArgs args, CustomResourceOptions? opts = null)
public RegistryPolicy(String name, RegistryPolicyArgs args)
public RegistryPolicy(String name, RegistryPolicyArgs args, CustomResourceOptions options)
type: aws-native:ecr:RegistryPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RegistryPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RegistryPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RegistryPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RegistryPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RegistryPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

RegistryPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RegistryPolicy resource accepts the following input properties:

PolicyText This property is required. object

The JSON policy text for your registry.

Search the CloudFormation User Guide for AWS::ECR::RegistryPolicy for more information about the expected schema for this property.

PolicyText This property is required. interface{}

The JSON policy text for your registry.

Search the CloudFormation User Guide for AWS::ECR::RegistryPolicy for more information about the expected schema for this property.

policyText This property is required. Object

The JSON policy text for your registry.

Search the CloudFormation User Guide for AWS::ECR::RegistryPolicy for more information about the expected schema for this property.

policyText This property is required. any

The JSON policy text for your registry.

Search the CloudFormation User Guide for AWS::ECR::RegistryPolicy for more information about the expected schema for this property.

policy_text This property is required. Any

The JSON policy text for your registry.

Search the CloudFormation User Guide for AWS::ECR::RegistryPolicy for more information about the expected schema for this property.

policyText This property is required. Any

The JSON policy text for your registry.

Search the CloudFormation User Guide for AWS::ECR::RegistryPolicy for more information about the expected schema for this property.

Outputs

All input properties are implicitly available as output properties. Additionally, the RegistryPolicy resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
RegistryId string
The account ID of the private registry the policy is associated with.
Id string
The provider-assigned unique ID for this managed resource.
RegistryId string
The account ID of the private registry the policy is associated with.
id String
The provider-assigned unique ID for this managed resource.
registryId String
The account ID of the private registry the policy is associated with.
id string
The provider-assigned unique ID for this managed resource.
registryId string
The account ID of the private registry the policy is associated with.
id str
The provider-assigned unique ID for this managed resource.
registry_id str
The account ID of the private registry the policy is associated with.
id String
The provider-assigned unique ID for this managed resource.
registryId String
The account ID of the private registry the policy is associated with.

Package Details

Repository
AWS Native pulumi/pulumi-aws-native
License
Apache-2.0

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.26.0 published on Wednesday, Mar 12, 2025 by Pulumi