Day 43: S3 Programmatic access with AWS-CLI ๐Ÿ’ป ๐Ÿ“ - 90DaysOfDevOps

ยท

2 min read

s3

S3

Amazon Simple Storage Service (Amazon S3) is an object storage service that provides a secure and scalable way to store and access data on the cloud. It is designed for storing any kind of data, such as text files, images, videos, backups, and more. Read more here

Task-01

  • Launch an EC2 instance using the AWS Management Console and connect to it using Secure Shell (SSH).
  • Create an S3 bucket and upload a file to it using the AWS Management Console.

  • Access the file from the EC2 instance using the AWS Command Line Interface (AWS CLI).

Steps -

  1. Go to EC2 and launch a new Ubuntu machine.

  2. SSH to the server

  3. Update the Ubuntu machine with the command - sudo apt update

  4. Install AWS CLI using the command - sudo apt install awscli -y

  5. Validate the AWS CLI using the command - aws --version

  1. Create a new user for AWS CLI from IAM with AmazonS3FullAccess and create access keys -

  1. Configure AWS CLI using the command - aws configure and use the access key that we generated -

  1. Now, let's create a new S3 bucket from the Console. Go to S3 > Create bucket > Give name and create.

  1. Upload some data in the bucket -

  1. Now, SSH to the Ubuntu machine and access the data from CLI -

  2. Run the command aws s3 ls to list all buckets and aws s3 ls s3://bucket-name to access data inside a bucket.

Task-02

  • Create a snapshot of the EC2 instance and use it to launch a new EC2 instance.

  • Download a file from the S3 bucket using the AWS CLI.

  • Verify that the contents of the file are the same on both EC2 instances.

Steps -

  1. Go to EC2 > Snapshot > Create Snapshot.

  1. Once the snapshot is created, create an image (AMI) from the snapshot.

  1. Access the AMI and create a new EC2 instance from AMI.

  1. Connect to both old and new EC2 machines and validate if we can see the same data in S3 buckets.

  2. Run the command aws s3 cp s3://day43-task-bucket/test_file.txt . to download a file from the bucket to the local machine.

Delete all Volumes/Snapshots/EC2/Buckets once you are done with the practice.

Thank you :)

ย