- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateRepositoryCreationTemplateCommand
Creates a repository creation template. This template is used to define the settings for repositories created by Amazon ECR on your behalf. For example, repositories created through pull through cache actions. For more information, see Private repository creation templates 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, CreateRepositoryCreationTemplateCommand } from "@aws-sdk/client-ecr"; // ES Modules import
// const { ECRClient, CreateRepositoryCreationTemplateCommand } = require("@aws-sdk/client-ecr"); // CommonJS import
const client = new ECRClient(config);
const input = { // CreateRepositoryCreationTemplateRequest
prefix: "STRING_VALUE", // required
description: "STRING_VALUE",
encryptionConfiguration: { // EncryptionConfigurationForRepositoryCreationTemplate
encryptionType: "AES256" || "KMS" || "KMS_DSSE", // required
kmsKey: "STRING_VALUE",
},
resourceTags: [ // TagList
{ // Tag
Key: "STRING_VALUE", // required
Value: "STRING_VALUE", // required
},
],
imageTagMutability: "MUTABLE" || "IMMUTABLE",
repositoryPolicy: "STRING_VALUE",
lifecyclePolicy: "STRING_VALUE",
appliedFor: [ // RCTAppliedForList // required
"REPLICATION" || "PULL_THROUGH_CACHE",
],
customRoleArn: "STRING_VALUE",
};
const command = new CreateRepositoryCreationTemplateCommand(input);
const response = await client.send(command);
// { // CreateRepositoryCreationTemplateResponse
// registryId: "STRING_VALUE",
// repositoryCreationTemplate: { // RepositoryCreationTemplate
// prefix: "STRING_VALUE",
// description: "STRING_VALUE",
// encryptionConfiguration: { // EncryptionConfigurationForRepositoryCreationTemplate
// encryptionType: "AES256" || "KMS" || "KMS_DSSE", // required
// kmsKey: "STRING_VALUE",
// },
// resourceTags: [ // TagList
// { // Tag
// Key: "STRING_VALUE", // required
// Value: "STRING_VALUE", // required
// },
// ],
// imageTagMutability: "MUTABLE" || "IMMUTABLE",
// repositoryPolicy: "STRING_VALUE",
// lifecyclePolicy: "STRING_VALUE",
// appliedFor: [ // RCTAppliedForList
// "REPLICATION" || "PULL_THROUGH_CACHE",
// ],
// customRoleArn: "STRING_VALUE",
// createdAt: new Date("TIMESTAMP"),
// updatedAt: new Date("TIMESTAMP"),
// },
// };
CreateRepositoryCreationTemplateCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
appliedFor Required | RCTAppliedFor[] | undefined | A list of enumerable strings representing the Amazon ECR repository creation scenarios that this template will apply towards. The two supported scenarios are |
prefix Required | string | undefined | The repository namespace prefix to associate with the template. All repositories created using this namespace prefix will have the settings defined in this template applied. For example, a prefix of To apply a template to all repositories in your registry that don't have an associated creation template, you can use There is always an assumed |
customRoleArn | string | undefined | The ARN of the role to be assumed by Amazon ECR. This role must be in the same account as the registry that you are configuring. Amazon ECR will assume your supplied role when the customRoleArn is specified. When this field isn't specified, Amazon ECR will use the service-linked role for the repository creation template. |
description | string | undefined | A description for the repository creation template. |
encryptionConfiguration | EncryptionConfigurationForRepositoryCreationTemplate | undefined | The encryption configuration to use for repositories created using the template. |
imageTagMutability | ImageTagMutability | undefined | The tag mutability setting for the repository. If this parameter is omitted, the default setting of |
lifecyclePolicy | string | undefined | The lifecycle policy to use for repositories created using the template. |
repositoryPolicy | string | undefined | The repository policy to apply to repositories created using the template. A repository policy is a permissions policy associated with a repository to control access permissions. |
resourceTags | Tag[] | undefined | The metadata to apply to the repository to help you categorize and organize. Each tag consists of a key and an optional 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. |
CreateRepositoryCreationTemplateCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
registryId | string | undefined | The registry ID associated with the request. |
repositoryCreationTemplate | RepositoryCreationTemplate | undefined | The details of the repository creation template associated with the request. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InvalidParameterException | client | The specified parameter is invalid. Review the available parameters for the API request. |
LimitExceededException | client | The operation did not succeed because it would have exceeded a service limit for your account. For more information, see Amazon ECR service quotas in the Amazon Elastic Container Registry User Guide. |
ServerException | server | These errors are usually caused by a server-side issue. |
TemplateAlreadyExistsException | client | The repository creation template already exists. Specify a unique prefix and try again. |
ValidationException | client | There was an exception validating this request. |
ECRServiceException | Base exception class for all service exceptions from ECR service. |