DEV Community

Cover image for aws-zero-to-hero Day3: Simple Storage Service
On-cloud7
On-cloud7

Posted on

aws-zero-to-hero Day3: Simple Storage Service

What is S3 Bucket in AWS?
Amazon Simple Storage Service (Amazon S3) is a scalable object storage service provided by Amazon Web Services (AWS). It is designed to store and retrieve any amount of data from anywhere on the web.
S3 is commonly used for a variety of purposes, such as backup and restore, archiving, content distribution, and hosting static websites.

What is IAM in AWS?
IAM stands for Identity and Access Management. IAM is a web service that helps you securely control access to AWS resources. It enables you to manage users, groups, and permissions to securely access and use AWS services and resources.

key components of IAM:

  • Users
  • Groups
  • Roles
  • Policies

What is AWSCLI?
The AWS Command Line Interface (AWS CLI) is a set of open-source command-line tools for interacting with Amazon Web Services (AWS) services. It allows users to control and manage AWS services directly from the command line, rather than using the AWS Management Console.

Tasks:
1) Make a private S3 bucket in AWS and change the policy so you can access its stuff without making it public.

To achieve this, you can configure an S3 bucket policy and IAM user or role permissions that allow specific access while keeping the bucket private. Here’s a step-by-step guide:

Step 1: Create a Private S3 Bucket

  1. Log in to the AWS Management Console.
  2. Go to the S3 service.
  3. Click Create Bucket and:

-Provide a Bucket Name (e.g., my-private-bucket).

  • Select the appropriate Region.
  • Ensure Block all public access is enabled.
  • Click Create Bucket.

Step 2: Modify Bucket Policy for Specific Access

  1. Navigate to your bucket in the S3 Console.
  2. Go to the Permissions tab.
  3. Under Bucket Policy, click Edit.
  4. Add a policy allowing specific access to a user, role, or IP range.

Step 3: Update IAM Permissions for the User or Role

  1. Go to the IAM Console.
  2. Select the User or Role you want to grant access to.
  3. Attach a policy like this:

2) Configure AWSCLI on your Ubuntu machine.
Step 1: Install AWS CLI
Update your system packages:

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Install AWS CLI using the package manager (version 1):

sudo apt install awscli -y
Enter fullscreen mode Exit fullscreen mode

OR (for the latest AWS CLI version 2):

curl 
"https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
 -o 
"awscliv2.zip"

unzip awscliv2.zip
sudo ./aws/install
Enter fullscreen mode Exit fullscreen mode

Verify the installation:

aws --version
Enter fullscreen mode Exit fullscreen mode

Step 2: Configure AWS CLI

aws configure
Enter fullscreen mode Exit fullscreen mode

Provide the following details when prompted:

  • AWS Access Key ID: Enter the access key for your IAM user.
  • AWS Secret Access Key: Enter the secret key for your IAM user.
  • Default Region Name: Enter the AWS region (e.g., us-east-1 or ap-south-1).
  • Default Output Format: Choose the format (json, table, or text).

3) Create an EC2 instance using AWSCLI.

Top comments (0)