Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scan command. #44

Merged
merged 10 commits into from
Sep 13, 2024
Merged

Add scan command. #44

merged 10 commits into from
Sep 13, 2024

Conversation

fujiwara
Copy link
Owner

@fujiwara fujiwara commented Sep 6, 2024

ecrm scan scans existing resources, and outputs image URIs in use.

Usage: ecrm scan [flags]

Scan ECS/Lambda resources. Output image URIs in use.

Flags:
  -o, --output="-"            File name of the output. The default is STDOUT ($ECRM_OUTPUT).

And add ecrm plan/delete --scanned-files flag. ecrm does not delete images in these files.

Usage: ecrm plan [flags]

Scan ECS/Lambda resources and find unused ECR images that can be deleted safely.

Flags:
      --[no-]scan                          Scan ECS/Lambda resources that in use ($ECRM_SCAN).
      --scanned-files=SCANNED-FILES,...    Files of the scan result. ecrm does not delete images in these

Combine these flags, ecrm enables to support multi regions / accounts.
For example,

  • The account A provides ECR.
  • The account B runs ECS tasks that using ECR images in account A.

In this case,

  1. ecrm scan --output in-use-b.json runs on account B.
  2. ecrm delete --scanned-files in-use-b.json runs on account A. ecrm keeps images used by account B not only used in account A.

Multiple --scanned-files flags are allowed. So account A can keep images in use by multi accounts safety.

ecrm scan only scans existing resources, and outputs image URIs in use.
@fujiwara fujiwara merged commit 0e6cb3b into main Sep 13, 2024
4 checks passed
@fujiwara fujiwara deleted the scan branch September 13, 2024 08:18
@github-actions github-actions bot mentioned this pull request Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant