Module ecr

@pulumi/awsx > ecr

class LifecyclePolicy

extends LifecyclePolicy

constructor

new LifecyclePolicy(name: string, repository: aws.ecr.Repository, args?: LifecyclePolicyArgs, opts?: pulumi.ComponentResourceOptions)

Creates a new [LifecyclePolicy] for the given [repository]. If [args] is not provided, then [getDefaultLifecyclePolicyArgs] will be used to set the default policy for this repo.

method defaultLifecyclePolicyArgs

public static defaultLifecyclePolicyArgs(): LifecyclePolicyArgs

Creates a default lifecycle policy such that at most a single untagged image is retained. All tagged layers and images will never expire.

method get

static get(name: string, id: pulumi.Input<pulumi.ID>, state?: LifecyclePolicyState, opts?: pulumi.CustomResourceOptions): LifecyclePolicy

Get an existing LifecyclePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property policy

policy: pulumi.Output<string>;

The policy document. This is a JSON formatted string. See more details about Policy Parameters in the official AWS docs. For more information about building IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.

property registryId

registryId: pulumi.Output<string>;

The registry ID where the repository was created.

property repository

repository: pulumi.Output<string>;

Name of the repository to apply the policy.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class Repository

extends ComponentResource

A [Repository] represents an [aws.ecr.Repository] along with an associated [LifecyclePolicy] controlling how images are retained in the repo.

Docker images can be built and pushed to the repo using the [buildAndPushImage] method. This will call into the @pulumi/docker/buildAndPushImage function using this repo as the appropriate destination registry.

constructor

new Repository(name: string, args: RepositoryArgs, opts: pulumi.ComponentResourceOptions)

method buildAndPushImage

public buildAndPushImage(pathOrBuild: pulumi.Input<string | docker.DockerBuild>): OutputInstance<string> & { ... }

Builds the docker container specified by [pathOrBuild] and pushes it to this repository. The result is the unique ID pointing to that pushed image in this repo. This unique ID can be passed as the value to image: repo.buildAndPushImage(...) in an ecs.Container.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property lifecyclePolicy

public lifecyclePolicy: aws.ecr.LifecyclePolicy | undefined;

property repository

public repository: aws.ecr.Repository;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class RepositoryImage

implements ContainerImageProvider

A simple pair of a [Repository] and a built docker image that was pushed to it. This can be passed in as the image: repoImage value to an ecs.Container.

constructor

new RepositoryImage(repository: Repository, image: pulumi.Input<string>)

method environment

public environment(): never[]

method image

public image(): string | Promise<string> | OutputInstance<string>

property imageValue

public imageValue: pulumi.Input<string>;

property repository

public repository: Repository;

function buildAndPushImage

buildAndPushImage(name: string, pathOrBuild: pulumi.Input<string | docker.DockerBuild>, args?: RepositoryArgs, opts?: pulumi.ComponentResourceOptions): RepositoryImage

Creates a new Repository, builds the docker container specified by [pathOrBuild] and then pushes the built image to the repository. The result contains both the Repository created as well as the unique ID referencing the built image in that repo. This result type can be passed in as image: ecr.buildAndPushImage(...) for an ecs.Container

function convertToJSON

interface LifecyclePolicyArgs

See https://docs.aws.amazon.com/AmazonECR/latest/userguide/lifecycle_policy_examples.html for more details.

property rules

rules: pulumi.Input<pulumi.Input<LifecyclePolicyRule>[]>;

Specifies the rules to determine how images should be retired from this repository. Rules are ordered from lowest priority to highest. If there is a rule with a selection value of any, then it will have the highest priority.

interface LifecyclePolicyRule

The following behaviors hold for these rules:

  • An image is expired by exactly one or zero rules.

  • An image that matches the tagging requirements of a higher priority rule cannot be expired by a rule with a lower priority.

  • Rules can never mark images that are marked by higher priority rules, but can still identify them as if they haven’t been expired.

  • The set of rules must contain a unique set of tag prefixes.

  • Only one rule is allowed to select untagged images.

  • Expiration is always ordered by pushed_at_time, and always expires older images before newer ones.

  • When using the tagPrefixList, an image is successfully matched if all of the tags in the tagPrefixList value are matched against any of the image’s tags.

  • With maximumNumberOfImages, images are sorted from youngest to oldest based on pushed_at_time and then all images greater than the specified count are expired.

  • With maximumAgeLimit, all images whose pushed_at_time is older than the specified number of days based on countNumber are expired.

property description

description?: pulumi.Input<string>;

Describes the purpose of a rule within a lifecycle policy.

property maximumAgeLimit

maximumAgeLimit?: pulumi.Input<number>;

The maximum age limit (in days) for your images. Either [maximumNumberOfImages] or [maximumAgeLimit] must be provided.

property maximumNumberOfImages

maximumNumberOfImages?: pulumi.Input<number>;

The maximum number of images that you want to retain in your repository. Either [maximumNumberOfImages] or [maximumAgeLimit] must be provided.

property selection

selection: pulumi.Input<“untagged” | “any” | {
    tagPrefixList: pulumi.Input<pulumi.Input<string>[]>;
}>;

Determines whether the lifecycle policy rule that you are adding specifies a tag for an image. If you specify any, then all images have the rule applied to them. If you specify untagged then the rule will only apply to untagged images. Otherwise, you can specify a tagPrefixList value.

interface RepositoryArgs

property lifeCyclePolicyArgs

lifeCyclePolicyArgs?: LifecyclePolicyArgs;

The arguments controlling the [LifecyclePolicy] for this [Repository]. If undefined, a default one will be created using LifecyclePolicy.getDefaultLifecyclePolicyArgs.

property repository

repository?: aws.ecr.Repository;

Underlying repository. If not provided, a new one will be created on your behalf.

property tags

tags?: pulumi.Input<Record<string, any>>;

A mapping of tags to assign to the resource.