Today I have covered,
What are IAM Programmatic Access and AWS CLI?
How to connect IAM Programmatic Access and AWS CLI?
What is IAM Programmatic access?
Programmatic access
allows you to invoke actions on your AWS resources either through an application that youwrite or through a third-party tool
. You use an access key ID and a secret access key to sign your requests for authorization to AWS.Programmatic access can be pretty powerful, so implementing best practices to
protect access key IDs
andsecret access keys
is essential toprevent accidental
ormalicious account activity
.
What is AWS CLI?
The AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services. With just
one tool to download
andconfigure
, you can controlmultiple AWS services
from the command line and automate them through scripts.The AWS CLI v2 offers several new features including improved
installers
,new configuration
options such asAWS IAM Identity
Center (successor toAWS SSO
), and various interactive features.
Task-01
Create AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from AWS Console.
Step-01: Go to
AWS Console -> Security credentials -> Access keys (access key ID and secret access key)
Step-02: Click on
Create New Access Key
which will generateAWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
for you.
- Step-03: Download the
CSV
file which contains theAWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
for you.
- Step 04: Verify the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
in theCSV
file.
Thus we have created an Access key ID and a Secret access key now we will connect to AWS CLI.
Task-02
Setup and install AWS CLI and configure your account credentials.
- Step-01: Install AWS CLI using the following command
sudo apt update
sudo apt install unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
- Step-02: Verify the installation using the following command
aws --version
- Step-03: Configure the AWS CLI using the following command in which we will provide the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
which we created in the previous task and also provide the theregion
we want to work and theoutput format
.
aws configure
- Step-04: Verify the configuration using the following command which will show the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
which we have provided in the previous step.
aws configure list
- Step-05: We can check whether the AWS CLI is working or not by checking the Ec2 instance using the following command.
aws ec2 describe-instances