Skip to content

Commit a01df47

Browse files
authored
aws-s3api: add page (#6132)
1 parent 4d63c00 commit a01df47

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

pages/common/aws-s3api.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# aws s3api
2+
3+
> Create and delete Amazon S3 buckets and edit bucket properties.
4+
> More information: <https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/index.html>.
5+
6+
- Create a bucket:
7+
8+
`aws s3api create-bucket --bucket {{bucket_name}}`
9+
10+
- Delete a bucket:
11+
12+
`aws s3api delete-bucket --bucket {{bucket_name}}`
13+
14+
- List buckets:
15+
16+
`aws s3api list-buckets`
17+
18+
- List the objects inside of a bucket and only show each object's key and size:
19+
20+
`aws s3api list-objects --bucket {{bucket_name}} --query '{{Contents[].{Key: Key, Size: Size}}}'`
21+
22+
- Add an object to a bucket:
23+
24+
`aws s3api put-object --bucket {{bucket_name}} --key {{object_key}} --body {{path/to/file}}`
25+
26+
- Download object from a bucket (The output file is always the last argument):
27+
28+
`aws s3api get-object --bucket {{bucket_name}} --key {{object_key}} {{path/to/output_file}}`
29+
30+
- Apply an Amazon S3 bucket policy to a specified bucket:
31+
32+
`aws s3api put-bucket-policy --bucket {{bucket_name}} --policy file://{{path/to/bucket_policy.json}}`
33+
34+
- Download the Amazon S3 bucket policy from a specified bucket:
35+
36+
`aws s3api get-bucket-policy --bucket {{bucket_name}} --query Policy --output {{json|table|text|yaml|yaml-stream}} > {{path/to/bucket_policy}}`

0 commit comments

Comments
 (0)