Using S3 from command line
- Navigate to aws console and launch aws cloud shell



- S3 bucket uri:
s3://<bucket-name>
s3://playingwithpolicies
- S3 object url:
s3://<bucket-name>/<object-name>
s3://playingwithpolicies/images/
- Using AWS from Command line enables automation as we can script what we want to automate
- AWS CLI will have the following structure
aws <service> [<sub-service>] <action> [<--arg1 value1> .. <--argn valuen>]
aws s3 ls
Activity 1:
- Get the list of all the buckets in your aws account
aws s3 ls
- Remove any bucket
aws s3 rb <s3-uri>
& to remove all the items and then delete bucket aws s3 rb <s3-uri> --force
- Create an s3 bucket
aws s3 mb <s3-uri>
- Create a file and upload to s3
aws s3 cp <local-path> <s3-uri>
Activity 2
- Create an s3 bucket and inside it create three folders
- images
- music
- videos
-
in each folder upload 50 text files from anywhere.
aws s3 cp --recursive files/ s3://playingwithcli/images
-
Try to copy images folder from s3 into your local system
Like this:
Like Loading...