aws-s3api
Create and delete Amazon S3 buckets and edit bucket properties. tldr-pages
On several platforms
Several platforms
Create bucket in a specific region
aws s3api create-bucket --bucket bucket_name --region region --create-bucket-configuration LocationConstraint=regionIdentify--bucketThe name of the bucket to create. AWS CLI reference--regionThe region to use. AWS CLI reference--create-bucket-configurationThe configuration information for the bucket. AWS CLI referenceDelete a bucket
aws s3api delete-bucket --bucket bucket_nameIdentify--bucketSpecifies the bucket being deleted. AWS CLI referenceList buckets
aws s3api list-bucketsIdentifyList 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}'Identify--bucketThe name of the bucket containing the objects. AWS CLI reference--queryA JMESPath query to use in filtering the response data. AWS CLI referenceAdd an object to a bucket
aws s3api put-object --bucket bucket_name --key object_key --body path/to/fileIdentify--bucketThe bucket name to which the PUT action was initiated. AWS CLI reference--keyObject key for which the PUT action was initiated. AWS CLI reference--bodyObject data. AWS CLI referenceDownload 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_fileIdentify--bucketThe bucket name containing the object. AWS CLI reference--keyKey of the object to get. AWS CLI referenceApply an Amazon S3 bucket policy to a specified bucket
aws s3api put-bucket-policy --bucket bucket_name --policy file://path/to/bucket_policy.jsonIdentify--bucketThe name of the bucket. AWS CLI reference--policyThe bucket policy as a JSON document. AWS CLI referenceDownload the Amazon S3 bucket policy from a specified bucket
aws s3api get-bucket-policy --bucket bucket_name --query Policy --output json >path/to/bucket_policyIdentify--bucketThe bucket name to get the bucket policy for. AWS CLI reference--queryA JMESPath query to use in filtering the response data. AWS CLI reference--outputThe formatting style for command output. AWS CLI reference