Amazon S3 Command Line Operations: Difference between revisions
Jump to navigation
Jump to search
Line 53: | Line 53: | ||
=Copy a File into a Bucket= | =Copy a File into a Bucket= | ||
aws s3 cp file.txt s3://''bucket-name''' [--grants read=uri=http | aws s3 cp file.txt s3://''bucket-name''' [--grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers full=emailaddress=user@example.com] |
Revision as of 02:02, 18 March 2019
Internal
List all Buckets
aws s3api list-buckets --query "Buckets[].Name"
List Objects in a Bucket
aws s3api list-objects --bucket bucket-name
Example:
aws s3api list-objects --bucket thalarion-release-pipeline { "Contents": [ { "LastModified": "2019-03-17T20:26:01.000Z", "ETag": "\"901056c645f90d6aa4edf0a98720a2a3\"", "StorageClass": "STANDARD", "Key": "thalarion/BuildspecP/Uew1P4u", "Owner": { "DisplayName": "aws-admin-dv1", "ID": "ca887c9c7e3f48cf499d19b960e5ee436cb4ce34e035463003b51c21ea6b4499" }, "Size": 395 }, { "LastModified": "2019-03-17T20:25:40.000Z", "ETag": "\"bbaa592d88d0d5024c776eed46fb6370-1\"", "StorageClass": "STANDARD", "Key": "thalarion/Repository/5CfRwn8.zip", "Owner": { "DisplayName": "aws-admin-dv1", "ID": "1f887c9c7e3f48cf499d195960e5ee436cb4ce3be035463003b51c21ea6b4493" }, "Size": 3156 } ] }
To return specific attributes:
aws s3api list-objects --bucket bucket-name --query 'Contents[].{Key: Key}'
Equivalent TO TEST:
aws s3 ls s3://bucket-name
Copy a File into a Bucket
aws s3 cp file.txt s3://bucket-name' [--grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers full=emailaddress=user@example.com]