From 3b71434c2091041b4c53d74a4cb490410ccb6486 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 11 Sep 2025 20:08:55 +0200 Subject: [PATCH] chore(aws): dump acquired knowledge --- knowledge base/cloud computing/aws/README.md | 2 +- knowledge base/cloud computing/aws/ecr.md | 15 +++++++++++++++ knowledge base/cloud computing/aws/s3.md | 2 ++ snippets/aws/other commands.fish | 7 +++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/knowledge base/cloud computing/aws/README.md b/knowledge base/cloud computing/aws/README.md index 12320bf..2e63b12 100644 --- a/knowledge base/cloud computing/aws/README.md +++ b/knowledge base/cloud computing/aws/README.md @@ -1003,6 +1003,7 @@ If one can, prefer just build the image from an EC2 instance. [i'm trying to export a snapshot from amazon rds mysql to amazon s3, but i'm receiving an error. why is this happening?]: https://repost.aws/knowledge-center/rds-mysql-export-snapshot [more info about resource deprecation?]: https://github.com/boto/boto3/discussions/3563 [nat gateways]: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html +[Pulling the Amazon Linux container image]: https://docs.aws.amazon.com/AmazonECR/latest/userguide/amazon_linux_container_image.html [rotating aws kms keys]: https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html [savings plans user guide]: https://docs.aws.amazon.com/savingsplans/latest/userguide/ [Services that support the Resource Groups Tagging API]: https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/supported-services.html @@ -1018,7 +1019,6 @@ If one can, prefer just build the image from an EC2 instance. [what is amazon vpc?]: https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html [what is aws config?]: https://docs.aws.amazon.com/config/latest/developerguide/WhatIsConfig.html [what is aws global accelerator?]: https://docs.aws.amazon.com/global-accelerator/latest/dg/what-is-global-accelerator.html -[Pulling the Amazon Linux container image]: https://docs.aws.amazon.com/AmazonECR/latest/userguide/amazon_linux_container_image.html [a guide to tagging resources in aws]: https://medium.com/@staxmarketing/a-guide-to-tagging-resources-in-aws-8f4311afeb46 diff --git a/knowledge base/cloud computing/aws/ecr.md b/knowledge base/cloud computing/aws/ecr.md index c57de39..19ae438 100644 --- a/knowledge base/cloud computing/aws/ecr.md +++ b/knowledge base/cloud computing/aws/ecr.md @@ -25,6 +25,14 @@ aws ecr delete-repository --repository-name 'banana/slug' aws ecr list-images --repository-name 'repository' aws ecr list-images --registry-id '123456789012' --repository-name 'my-image' +# Check images exist in the ECR. +[[ \ + $( + aws ecr list-images --repository-name 'repository' \ + --query "length(imageIds[?@.imageTag=='latest'])" --output 'text' \ + ) -le 0 \ +]] && echo "image 'repository:latest' exists" || echo "image 'repository:latest' does not exist" + # Use ECRs as Docker registries. aws ecr get-login-password \ @@ -67,6 +75,13 @@ aws ecr describe-repositories --repository-names 'docker-tools/image-builder' \ || aws ecr create-repository --repository-name 'docker-tools/image-builder' ``` +Constraints: + +| What | Type | Constraints | Reference | +| --------------- | ------ | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| Image tag | String | 1 <= length <= 300 | [ImageIdentifier](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_ImageIdentifier.html) | +| Repository name | String | 2 <= length <= 256
Must match `(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)*` | [Image](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_Image.html) | + ## Pull through cache feature > **Note:** when requesting an image for the first time using the pull through cache, the ECR creates a new repository diff --git a/knowledge base/cloud computing/aws/s3.md b/knowledge base/cloud computing/aws/s3.md index 0ef0c26..725eafc 100644 --- a/knowledge base/cloud computing/aws/s3.md +++ b/knowledge base/cloud computing/aws/s3.md @@ -225,6 +225,7 @@ Examples: [1][lifecycle configuration examples], [2][s3 lifecycle rules example - [Using S3 Intelligent-Tiering] - [Amazon S3 cost optimization for predictable and dynamic access patterns] - [Gateway Endpoints vs Internet Routing for S3] +- [Understanding your AWS billing and usage reports for Amazon S3] ### Sources @@ -260,6 +261,7 @@ Examples: [1][lifecycle configuration examples], [2][s3 lifecycle rules example [lifecycle configure notification]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configure-notification.html [lifecycle general considerations for transitions]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html [Understanding and managing Amazon S3 storage classes]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html +[Understanding your AWS billing and usage reports for Amazon S3]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/aws-usage-report-understand.html [Using S3 Intelligent-Tiering]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-intelligent-tiering.html diff --git a/snippets/aws/other commands.fish b/snippets/aws/other commands.fish index f87bc9a..f315ff7 100644 --- a/snippets/aws/other commands.fish +++ b/snippets/aws/other commands.fish @@ -116,6 +116,13 @@ aws ecr describe-pull-through-cache-rules --registry-id '012345678901' --ecr-rep aws ecr list-images --registry-id '012345678901' --repository-name 'cache/docker-hub' +# Check images exist in the ECR. +[[ $( + aws ecr list-images --repository-name 'repository' \ + --query "length(imageIds[?@.imageTag=='latest'])" --output 'text' \ + ) -le 0 \ +]] && echo "image 'repository:latest' exists" || echo "image 'repository:latest' does not exist" + ### # ECS