Documentation ¶
Overview ¶
ECR Cleanup ¶
The `ecrcleanup` custom resource is meant to be dependant to an ECR repository. It does nothing on creation and will remove all images of the ECR repository on deletion if and only if the stack to which it belongs is also in deletion status. It is therefore a relatively dangerous resource.
The AWS ECR resource cannot be deleted if images still exsists. It is where the `ecrcleanup` custom resource plays its role by depending on the ECR repository. Its intended usage is for prototype stacks with short lived ECR repository when one wants to quickly create and delete ECR repositories.
It is not dangerouse to delete the resource itself when updating the stack as the `ecrcleanup` custom resource only cleanup the content when the stack is getting deleted.
## Syntax
To create an ecrcleanup resource, add the following resource to your cloudformation template (yaml notation, json is similar)
```yaml MyEcrCleanup:
Type: Custom::EcrCleanup Properties: ServiceToken: Fn::ImportValue: !Sub ${HyperdriveCore}-EcrCleanup Repository: <repository name>
```
## Properties
`Repository`
> The name of the repository to clean when the resource is deleted while its stack > itself is deleted > > _Type_: Repository Name > > _Required_: Yes > > _Update Requires_: no interruption