AWS CLI Contd
- To authenticate AWS CLI we need to create IAM user
- Refer Here for creating IAM User
-
In AWS For using s3 from commandline we have two CLI Commands available
- aws s3 Refer Here
- aws s3api Refer Here
Scenario 1
- Create an s3 bucket and upload any folder from your system into s3 bucket
- Create one more s3 bucket in a different region and copy the contents of the uploads in the above section to the new bucket
- Create one more file the folder of your local sytem and ensure only the created file gets copied and also sync the same with the other bucket
- Now delete the newly created file and perform sync once again
- Now create a file with some text and sync and check with modifications
- aws s3 sync is able to sync newly created files and modified files but ignoring the deleted files
aws s3 mb s3://qtscenarios25june
aws s3 cp --recursive "C:\temp\ForS3\Videos" s3://qtscenarios25june/Videos
aws s3 mb s3://qtscenarios25june-1 --region 'ap-south-1'
aws s3 cp --recursive s3://qtscenarios25june/Videos s3://qtscenarios25june-1/Videos
aws s3 sync "C:\temp\ForS3\Videos" s3://qtscenarios25june/Videos
aws s3 sync s3://qtscenarios25june/Videos s3://qtscenarios25june-1/Videos
aws s3 cp --recursive "C:\temp\ForS3\Docs" s3://qtscenarios25june/Docs
Scenario 2-Exercise:
- Delete all the s3 buckets
- Create a new s3 bucket
- upload an object with size atleast 10 MB to the bucket
- change the storage class from standard to infrequent-access
- Remove the object
- upload a new object with private access
- download the new object with s3 cli
- Create a new bucket and move the object into the new bucket