MultiCloud Classroom notes 26/Oct/2024

AWS S3 CLI

  • AWS CLI for S3 comes with two commands
    • s3: simple interface
    • s3api: low level calls
  • Terms:

    • S3uri:
      • bucket: s3://<bucket-name>
        • Examples:
          • s3://ltdocsforlearning
      • object: s3://<bucket-name>/<path-to-object>
        • Examples:
          • s3://ltdocsforlearning/docs/1.txt
  • Setting up aws cli

    • AWS CLI access key and secret key setup on workstation
    • AWS IAM Role to access s3 on EC2 instance

How to use aws cli


Activities

  • Setup necessary IAM Permission on your workstation
  • Get all the s3 buckets
aws s3 ls
  • Create a new bucket
aws s3 mb s3://<new-bucket-name>

Preview
* upload some files from local system to new bucket

aws s3 cp <source> <destination>

Preview
Preview
* upload folders into new bucket
Preview
Preview
Preview
* copy the contents of new bucket into another bucket post creation
Preview
* delete both buckets
Preview

  • Download any website template into a folder on your workstation Refer Here
    • cd in to the folder with index.html
    • Now cp the contents to a new bucket
  • Grant public read access
{
    "Version": "2012-10-17",
    "Id": "Policy1729912460136",
    "Statement": [
        {
            "Sid": "Stmt1729912458418",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::ltwebsite.com/*"
        }
    ]
}
  • Findout commands to unblock public access and upload the s3 bucket policy
  • I want to backup a folder on my system to s3 for which using sync is recommended

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube