PutRegistryPolicyCommand

Creates or updates the permissions policy for your registry.

A registry policy is used to specify permissions for another Amazon Web Services account and is used when configuring cross-account replication. For more information, see Registry permissions  in the Amazon Elastic Container Registry User Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ECRClient, PutRegistryPolicyCommand } from "@aws-sdk/client-ecr"; // ES Modules import
// const { ECRClient, PutRegistryPolicyCommand } = require("@aws-sdk/client-ecr"); // CommonJS import
const client = new ECRClient(config);
const input = { // PutRegistryPolicyRequest
  policyText: "STRING_VALUE", // required
};
const command = new PutRegistryPolicyCommand(input);
const response = await client.send(command);
// { // PutRegistryPolicyResponse
//   registryId: "STRING_VALUE",
//   policyText: "STRING_VALUE",
// };

PutRegistryPolicyCommand Input

See PutRegistryPolicyCommandInput for more details

Parameter
Type
Description
policyText
Required
string | undefined

The JSON policy text to apply to your registry. The policy text follows the same format as IAM policy text. For more information, see Registry permissions  in the Amazon Elastic Container Registry User Guide.

PutRegistryPolicyCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
policyText
string | undefined

The JSON policy text for your registry.

registryId
string | undefined

The registry ID associated with the request.

Throws

Name
Fault
Details
InvalidParameterException
client

The specified parameter is invalid. Review the available parameters for the API request.

ServerException
server

These errors are usually caused by a server-side issue.

ValidationException
client

There was an exception validating this request.

ECRServiceException
Base exception class for all service exceptions from ECR service.