AWS CLI
LIST # list all the available s3 buckets aws s3 ls [list with bucket name] aws s3 ls s3://bucket-name/ # list all the sub-folders and files aws s3 ls s3://bucket-name/ --recursive (i.e., aws s3 ls s3://prashanth-sams --recursive) # list all the bucket names with it's size aws s3 ls s3://bucket-name/ --summarize CREATE # create new bucket; here mb is 'make bucket' aws s3 mb s3://bucket-name/ (i.e., aws s3 mb s3://prashanth-sams) # create new bucket with specific region aws s3 mb s3://bucket-name/ --region us-east-1 COPY | MOVE # copy a file inside bucket aws s3 cp source-file s3://bucket-name/ (i.e., aws s3 cp /file.html s3://prashanth-sams) # move a file inside bucket aws s3 mv source-file s3://bucket-name/ (i.e., aws s3 mv /file.html s3://prashanth-sams) DELETE # delete all the data inside a bucket aws s3 rm s3://bucket-name/ --recursive # delete all files and folders excluding a specific file pattern aws s3 rm s3://bucket-name/ --recursive --exclude "*.html" # delete all files and folders excluding a specific folder aws s3 rm s3://bucket-name/ --recursive --exclude "folder/*" # delete a bucket which is empty; here, rb is 'remove bucket' aws s3 rb s3://bucket-name # delete a bucket which is not empty aws s3 rb s3://bucket-name --force SYNC # upload or sync your local data to remote s3 bucket aws s3 sync . s3://bucket-name # upload data by excluding files/folders with specific pattern to remote s3 bucket aws s3 sync . s3://bucket-name --exclude "*.tgz" aws s3 sync . s3://bucket-name --exclude "folder/*" # download or sync your remote s3 bucket data to local aws s3 sync s3://bucket-name . # download data by excluding files/folders with specific pattern to local aws s3 sync s3://bucket-name . --exclude "*.tgz" aws s3 sync s3://bucket-name . --exclude "folder/*" # copy or sync your remote s3 bucket data to another s3 bucket aws s3 sync s3://bucket-name1 s3://bucket-name2 # update and deleted file/folder in remote s3 aws s3 sync . s3://bucket-name --delete DYNAMIC URL # make data public and open to users with dynamic access key [default expire time of the link will be 3600 secs] aws s3 presign s3://bucket-name/file.html # make data public for a specific time period aws s3 presign s3://bucket-name/file.html --expires-in 30 STATIC WEBSITE # static url for a html file aws s3 website s3://bucket-name --index-document index.html # static url for a html file with working and not working document aws s3 website s3://bucket-name --index-document index.html --error-document error.html OUTPUT http://bucket-name.s3-website-us-east-1.amazonaws.com/ (i.e., http://prashanth-sams.s3-website-us-east-1.amazonaws.com/)
AWS Console
CREATE BUCKET
- Go to S3 in aws console
- Click on
Create bucket

- Enter bucket name, Region, and click on the create button

- Select Bucket name and click on
Edit public access settings

- Untick
Block all public accessand click on the save button

- Now, click on the bucket-name and upload files
- Select the file and make it public

- Now, click on the file and open the link



















