pull_through_cache_rules
Creates, updates, deletes, gets or lists a pull_through_cache_rules resource.
Overview
| Name | pull_through_cache_rules |
| Type | Resource |
| Id | aws.ecr.pull_through_cache_rules |
Fields
The following fields are returned by SELECT queries:
- describe_pull_through_cache_rules
| Name | Datatype | Description |
|---|---|---|
created_at | string (date-time) | The date and time the pull through cache was created. |
credential_arn | string | The ARN of the Secrets Manager secret associated with the pull through cache rule. (pattern: <code>^arn:aws(-\w+)*:secretsmanager:[a-zA-Z0-9-:]+:secret:ecr-pullthroughcache/[a-zA-Z0-9/_+=.@-]+$</code>) |
custom_role_arn | string | The ARN of the IAM role associated with the pull through cache rule. |
ecr_repository_prefix | string | The Amazon ECR repository prefix associated with the pull through cache rule. (pattern: <code>^([a-z0-9]+((.||__|-+)[a-z0-9]+)*(/[a-z0-9]+((.||__|-+)[a-z0-9]+))/?|ROOT)$</code>) |
registry_id | string | The Amazon Web Services account ID associated with the registry the pull through cache rule is associated with. (pattern: <code>[0-9]{12}</code>) |
updated_at | string (date-time) | The date and time, in JavaScript date format, when the pull through cache rule was last updated. |
upstream_registry | string | The name of the upstream source registry associated with the pull through cache rule. (ecr, ecr-public, quay, k8s, docker-hub, github-container-registry, azure-container-registry, gitlab-container-registry, chainguard) |
upstream_registry_url | string | The upstream registry URL associated with the pull through cache rule. |
upstream_repository_prefix | string | The upstream repository prefix associated with the pull through cache rule. (pattern: <code>^([a-z0-9]+((.||__|-+)[a-z0-9]+)*(/[a-z0-9]+((.||__|-+)[a-z0-9]+))/?|ROOT)$</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_pull_through_cache_rules | select | region | Returns the pull through cache rules for a registry. | |
create_pull_through_cache_rule | insert | region, ecrRepositoryPrefix, upstreamRegistryUrl | Creates a pull through cache rule. A pull through cache rule provides a way to cache images from an upstream registry source in your Amazon ECR private registry. For more information, see Using pull through cache rules in the Amazon Elastic Container Registry User Guide. | |
update_pull_through_cache_rule | update | region, ecrRepositoryPrefix | Updates an existing pull through cache rule. | |
delete_pull_through_cache_rule | delete | region | Deletes a pull through cache rule. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- describe_pull_through_cache_rules
Returns the pull through cache rules for a registry.
SELECT
created_at,
credential_arn,
custom_role_arn,
ecr_repository_prefix,
registry_id,
updated_at,
upstream_registry,
upstream_registry_url,
upstream_repository_prefix
FROM aws.ecr.pull_through_cache_rules
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_pull_through_cache_rule
- Manifest
Creates a pull through cache rule. A pull through cache rule provides a way to cache images from an upstream registry source in your Amazon ECR private registry. For more information, see Using pull through cache rules in the Amazon Elastic Container Registry User Guide.
INSERT INTO aws.ecr.pull_through_cache_rules (
ecrRepositoryPrefix,
upstreamRegistryUrl,
registryId,
upstreamRegistry,
credentialArn,
customRoleArn,
upstreamRepositoryPrefix,
region
)
SELECT
'{{ ecrRepositoryPrefix }}' /* required */,
'{{ upstreamRegistryUrl }}' /* required */,
'{{ registryId }}',
'{{ upstreamRegistry }}',
'{{ credentialArn }}',
'{{ customRoleArn }}',
'{{ upstreamRepositoryPrefix }}',
'{{ region }}'
RETURNING
created_at,
credential_arn,
custom_role_arn,
ecr_repository_prefix,
registry_id,
upstream_registry,
upstream_registry_url,
upstream_repository_prefix
;
# Description fields are for documentation purposes
- name: pull_through_cache_rules
props:
- name: region
value: "{{ region }}"
description: Required parameter for the pull_through_cache_rules resource.
- name: ecrRepositoryPrefix
value: "{{ ecrRepositoryPrefix }}"
description: |
The repository name prefix to use when caching images from the source registry. There is always an assumed / applied to the end of the prefix. If you specify ecr-public as the prefix, Amazon ECR treats that as ecr-public/.
- name: upstreamRegistryUrl
value: "{{ upstreamRegistryUrl }}"
description: |
The registry URL of the upstream public registry to use as the source for the pull through cache rule. The following is the syntax to use for each supported upstream registry. Amazon ECR (ecr) – `<accountId>`.dkr.ecr.`<region>`.amazonaws.com Amazon ECR Public (ecr-public) – public.ecr.aws Docker Hub (docker-hub) – registry-1.docker.io GitHub Container Registry (github-container-registry) – ghcr.io GitLab Container Registry (gitlab-container-registry) – registry.gitlab.com Kubernetes (k8s) – registry.k8s.io Microsoft Azure Container Registry (azure-container-registry) – `<custom>`.azurecr.io Quay (quay) – quay.io
- name: registryId
value: "{{ registryId }}"
description: |
The Amazon Web Services account ID associated with the registry to create the pull through cache rule for. If you do not specify a registry, the default registry is assumed.
- name: upstreamRegistry
value: "{{ upstreamRegistry }}"
description: |
The name of the upstream registry.
valid_values: ['ecr', 'ecr-public', 'quay', 'k8s', 'docker-hub', 'github-container-registry', 'azure-container-registry', 'gitlab-container-registry', 'chainguard']
- name: credentialArn
value: "{{ credentialArn }}"
description: |
The Amazon Resource Name (ARN) of the Amazon Web Services Secrets Manager secret that identifies the credentials to authenticate to the upstream registry.
- name: customRoleArn
value: "{{ customRoleArn }}"
description: |
Amazon Resource Name (ARN) of the IAM role to be assumed by Amazon ECR to authenticate to the ECR upstream registry. This role must be in the same account as the registry that you are configuring.
- name: upstreamRepositoryPrefix
value: "{{ upstreamRepositoryPrefix }}"
description: |
The repository name prefix of the upstream registry to match with the upstream repository name. When this field isn't specified, Amazon ECR will use the ROOT.
UPDATE examples
- update_pull_through_cache_rule
Updates an existing pull through cache rule.
UPDATE aws.ecr.pull_through_cache_rules
SET
registryId = '{{ registryId }}',
ecrRepositoryPrefix = '{{ ecrRepositoryPrefix }}',
credentialArn = '{{ credentialArn }}',
customRoleArn = '{{ customRoleArn }}'
WHERE
region = '{{ region }}' --required
AND ecrRepositoryPrefix = '{{ ecrRepositoryPrefix }}' --required
RETURNING
credential_arn,
custom_role_arn,
ecr_repository_prefix,
registry_id,
updated_at,
upstream_repository_prefix;
DELETE examples
- delete_pull_through_cache_rule
Deletes a pull through cache rule.
DELETE FROM aws.ecr.pull_through_cache_rules
WHERE region = '{{ region }}' --required
;