Day 31: IAM Programmatic access and AWS CLI ☁

Day 31: IAM Programmatic access and AWS CLI ☁

What is IAM Programmatic access?

IAM Programmatic access is a way to allow users or services to interact with AWS resources through APIs, SDKs, or command-line tools, such as AWS CLI, instead of the AWS Management Console. With programmatic access, users or services can perform automated tasks, manage resources, and access data in AWS without manual intervention.

What is AWS CLI?

AWS CLI (command-line interface) is a unified tool that provides a command-line interface for interacting with AWS services. It allows users to manage AWS resources using commands in the terminal or scripts, making it easier to automate tasks and manage large-scale deployments. The AWS CLI supports a wide range of AWS services, including EC2, S3, Lambda, and more, and can be installed on Windows, macOS, and Linux.

Task-01

Create AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from AWS Console.

Open the Amazon Management Console and log in from the user account not from the root user. We have created a user in a previous story.

Root user access keys are not recommended

We don’t recommend that you create root user access keys. Because you can’t specify the root user in a permissions policy, you can’t limit its permissions, which is a best practice.

At What is IAM Programmatic access? IAM Programmatic access is a way to allow users or services to interact with AWS resources through APIs, SDKs, or command-line tools, such as AWS CLI, instead of the AWS Management Console. With programmatic access, users or services can perform automated tasks, manage resources, and access data in AWS without manual intervention.

What is AWS CLI? AWS CLI (command-line interface) is a unified tool that provides a command-line interface for interacting with AWS services. It allows users to manage AWS resources using commands in the terminal or scripts, making it easier to automate tasks and manage large-scale deployments. The AWS CLI supports a wide range of AWS services, including EC2, S3, Lambda, and more, and can be installed on Windows, macOS, and Linux.

accpreviouslyessTask-01 Create AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from AWS Console.

Open the Amazon Management Console and log in from the user account not from the root user. We have created a user in the previous story.

Root user access keys are not recommended

We don’t recommend that you create root user access keys. Because you can’t specify the root user in a permissions policy, you can’t limit its permissions, which is a best practice.

At the top left corner of the console, click on search for IAM, and then choose “IAM” service from the result list.

Navigate to the user's section.

We have already seen how to create an IAM user in my previous blog. Here I have created a user "thor".

Navigate to the security credentials section and create an Access Key.

Click on “Create access key”.

Choose the CLI option or as per your requirement.

Now, create the access key.

You can see two keys now which are the Access key and the Secret access key Save it.

You can verify the status of the key in the user section.

Task-02 Setup and install AWS CLI and configure your account credentials

Install the AWS CLI by following the instructions for your operating system: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

Download the Windows version of AWS CLI.

Follow the default process to install the CLI version.

After the installation, navigate to CMD and check the CLI version.

Connect AWS to CLI by providing the keys generated in Task 1. You can verify the connection of CLI to AWS by checking available instances in AWS.

Wrapping Up Congratulations! You've now set up IAM programmatic access and AWS CLI, empowering you to manage AWS services more efficiently from the command line. Remember to follow AWS security best practices, such as regularly rotating access keys and limiting permissions based on the principle of least privilege, to ensure a secure environment.

I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching . thank you : ) In the top left corner of the console, click on search for IAM, and then choose “IAM” service from the result list.

Navigate to the user's section.

We have already seen how to create an IAM user in my previous blog. Here I have created a user "thor".

Navigate to the security credentials section and create an Access Key.

Click on “Create access key”.

Choose the CLI option or as per your requirement.

Now, create the access key.

usersYou can see two keys now which are the Access key and the Secret access key Save it.

You can verify the status of the key in the user section.

Task-02

Setup and install AWS CLI and configure your account credentials

Install the AWS CLI by following the instructions for your operating system: Linux docs.aws.amazon.com/cli/latest/userguide/in..

Follow the default process for Linux to install the CLI version.

After the installation, navigate to CMD and check the CLI version.

Connect AWS to CLI by providing the keys generated in Task 1. You can verify the connection of CLI to AWS by checking available instances in AWS.

Wrapping Up

Congratulations! You've now set up IAM programmatic access and AWS CLI, empowering you to manage AWS services more efficiently from the command line. Remember to follow AWS security best practices, such as regularly rotating access keys and limiting permissions based on the principle of least privilege, to ensure a secure environment.

I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching.

Thank You!

Keep Learning :)