Skip to main content

repository_policies

Creates, updates, deletes, gets or lists a repository_policies resource.

Overview

Namerepository_policies
TypeResource
Idaws.ecr_public.repository_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
policy_textstringThe repository policy text that's associated with the repository. The policy text will be in JSON format.
registry_idstringThe registry ID that's associated with the request. (pattern: <code>[0-9]{12}</code>)
repository_namestringThe repository name that's associated with the request. (pattern: <code>(?:[a-z0-9]+(?:[.-][a-z0-9]+)/)[a-z0-9]+(?:[.-][a-z0-9]+)*</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_repository_policyselectregionRetrieves the repository policy for the specified repository.
set_repository_policyupdateregion, repositoryName, policyTextApplies a repository policy to the specified public repository to control access permissions. For more information, see Amazon ECR Repository Policies in the Amazon Elastic Container Registry User Guide.
delete_repository_policydeleteregionDeletes the repository policy that's associated with the specified repository.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves the repository policy for the specified repository.

SELECT
policy_text,
registry_id,
repository_name
FROM aws.ecr_public.repository_policies
WHERE region = '{{ region }}' -- required
;

UPDATE examples

Applies a repository policy to the specified public repository to control access permissions. For more information, see Amazon ECR Repository Policies in the Amazon Elastic Container Registry User Guide.

UPDATE aws.ecr_public.repository_policies
SET
registryId = '{{ registryId }}',
repositoryName = '{{ repositoryName }}',
policyText = '{{ policyText }}',
force = {{ force }}
WHERE
region = '{{ region }}' --required
AND repositoryName = '{{ repositoryName }}' --required
AND policyText = '{{ policyText }}' --required
RETURNING
policy_text,
registry_id,
repository_name;

DELETE examples

Deletes the repository policy that's associated with the specified repository.

DELETE FROM aws.ecr_public.repository_policies
WHERE region = '{{ region }}' --required
;