From a01df47bc1a2ac9b568cd3707317795b84bc1d5a Mon Sep 17 00:00:00 2001 From: 258204 <71364336+258204@users.noreply.github.com> Date: Thu, 24 Jun 2021 00:01:52 +0930 Subject: [PATCH] aws-s3api: add page (#6132) --- pages/common/aws-s3api.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pages/common/aws-s3api.md diff --git a/pages/common/aws-s3api.md b/pages/common/aws-s3api.md new file mode 100644 index 000000000..7f62826db --- /dev/null +++ b/pages/common/aws-s3api.md @@ -0,0 +1,36 @@ +# aws s3api + +> Create and delete Amazon S3 buckets and edit bucket properties. +> More information: . + +- Create a bucket: + +`aws s3api create-bucket --bucket {{bucket_name}}` + +- Delete a bucket: + +`aws s3api delete-bucket --bucket {{bucket_name}}` + +- List buckets: + +`aws s3api list-buckets` + +- List the objects inside of a bucket and only show each object's key and size: + +`aws s3api list-objects --bucket {{bucket_name}} --query '{{Contents[].{Key: Key, Size: Size}}}'` + +- Add an object to a bucket: + +`aws s3api put-object --bucket {{bucket_name}} --key {{object_key}} --body {{path/to/file}}` + +- Download object from a bucket (The output file is always the last argument): + +`aws s3api get-object --bucket {{bucket_name}} --key {{object_key}} {{path/to/output_file}}` + +- Apply an Amazon S3 bucket policy to a specified bucket: + +`aws s3api put-bucket-policy --bucket {{bucket_name}} --policy file://{{path/to/bucket_policy.json}}` + +- Download the Amazon S3 bucket policy from a specified bucket: + +`aws s3api get-bucket-policy --bucket {{bucket_name}} --query Policy --output {{json|table|text|yaml|yaml-stream}} > {{path/to/bucket_policy}}`