diff --git a/knowledge base/cloud computing/aws/cli.md b/knowledge base/cloud computing/aws/cli.md index 99c97ec..c6b1329 100644 --- a/knowledge base/cloud computing/aws/cli.md +++ b/knowledge base/cloud computing/aws/cli.md @@ -5,6 +5,7 @@ 1. [TL;DR](#tldr) 1. [Profiles](#profiles) 1. [Further readings](#further-readings) + 1. [Sources](#sources) ## TL;DR @@ -21,6 +22,11 @@ aws configure --profile 'work' export AWS_PROFILE='work' +# Enable auto-prompt mode (like aws-shell). +aws configure set 'cli_auto_prompt' 'on-partial' +export AWS_CLI_AUTO_PROMPT='on' + + # List all SageMaker EndpointConfigurations' names. aws sagemaker list-endpoint-configs --output 'yaml-stream' | yq -r '.[].EndpointConfigs[].EndpointConfigName' - aws sagemaker list-endpoint-configs --output 'yaml-stream' --query 'EndpointConfigs[].EndpointConfigName' | yq -r '.[].[]' - @@ -73,6 +79,10 @@ $ export AWS_PROFILE="work" - CLI [quickstart] - [Configure profiles] in the CLI +### Sources + +- [Improved CLI auto-prompt mode] + @@ -85,3 +95,4 @@ $ export AWS_PROFILE="work" [quickstart]: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html [configure profiles]: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html +[improved cli auto-prompt mode]: https://github.com/aws/aws-cli/issues/5664 diff --git a/knowledge base/cloud computing/aws/s3.md b/knowledge base/cloud computing/aws/s3.md index 2ee803c..fda4594 100644 --- a/knowledge base/cloud computing/aws/s3.md +++ b/knowledge base/cloud computing/aws/s3.md @@ -13,13 +13,20 @@ ```sh # List all buckets. aws s3 ls +aws s3api list-buckets --output 'json' --query 'Buckets[].Name' +aws s3api list-buckets --output 'yaml-stream' | yq -r '.[].Buckets[].Name' - # List prefixes and objects in buckets. # Adding the trailing '/' or '--recurse' lists the content of prefixes. aws s3 ls 's3://my-bucket' -aws s3 ls 's3://my-bucket/prefix/' --recursive --human-readable --summarize +aws s3 ls --recursive 's3://my-bucket/prefix/' aws s3 ls 's3://arn:aws:s3:us-west-2:123456789012:accesspoint/myaccesspoint/' +# Find the size of buckets or objects. +# It will list all the contents *and* give a total size at the end. +aws s3 ls --human-readable --recursive --summarize 's3://my-bucket' +aws s3 ls … 's3://my-bucket/prefix/' + # Create buckets. aws s3 mb 's3://my-bucket' @@ -36,7 +43,7 @@ aws s3 cp 's3://my-bucket/logs/' 's3://my-bucket2/logs/' --recursive \ aws s3 cp 's3://my-bucket/test.txt' 's3://my-bucket/test2.txt' \ --acl 'public-read-write' aws s3 cp 'file.txt' 's3://my-bucket/' \ - --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers \ + --grants read=uri='http://acs.amazonaws.com/groups/global/AllUsers' \ 'full=id=79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be' aws s3 cp 'mydoc.txt' 's3://arn:aws:s3:us-west-2:123456789012:accesspoint/myaccesspoint/mykey' @@ -82,7 +89,7 @@ aws s3 delete-bucket-lifecycle --bucket 'batman' ## Lifecycle configuration -When you have multiple rules in an S3 Lifecycle configuration, an object can become eligible for multiple S3 Lifecycle actions. In such cases, Amazon S3 follows these general rules: +When one has multiple rules in an S3 Lifecycle configuration, an object can become eligible for multiple S3 Lifecycle actions. In such cases, Amazon S3 follows these general rules: 1. Permanent deletion takes precedence over transition. 1. Transition takes precedence over creation of delete markers. @@ -106,6 +113,8 @@ Examples: [1][lifecycle configuration examples], [2][s3 lifecycle rules example - [General considerations for transitions][lifecycle general considerations for transitions] - [Lifecycle configuration examples][lifecycle configuration examples] - [CLI subcommand reference] +- [Find out the size of your Amazon S3 buckets] +- [How S3 Intelligent-Tiering works] [cli subcommand reference]: https://docs.aws.amazon.com/cli/latest/reference/s3/ [expiring amazon s3 objects based on last accessed date to decrease costs]: https://aws.amazon.com/blogs/architecture/expiring-amazon-s3-objects-based-on-last-accessed-date-to-decrease-costs/ +[find out the size of your amazon s3 buckets]: https://aws.amazon.com/blogs/storage/find-out-the-size-of-your-amazon-s3-buckets/ +[how s3 intelligent-tiering works]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering-overview.html [lifecycle configuration examples]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configuration-examples.html [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