IAM Programmatic access and AWS CLI 🚀 ☁

IAM Programmatic access and AWS CLI 🚀 ☁

IAM Programmatic access:-

Programmatic access in the context of AWS (Amazon Web Services) refers to the ability to interact with AWS services using code or scripts, rather than through the AWS Management Console. IAM (Identity and Access Management) is the service in AWS that enables you to manage access to AWS services and resources securely. When you want to enable programmatic access to AWS resources, you typically create IAM users and provide them with access keys.

Here are the general steps to enable programmatic access using IAM:

  1. Create an IAM User:

    • Sign in to the AWS Management Console.

    • Open the IAM console at https://console.aws.amazon.com/iam/.

    • In the navigation pane, choose "Users" and then "Add user."

    • Enter a username for the new IAM user.

    • Choose the type of access this user will have (programmatic access, AWS Management Console access, or both).

    • Set permissions for the user. You can either attach existing policies to the user or grant specific permissions.

    • Review the user details and click "Create user."

  2. Access Key ID and Secret Access Key:

    • Once the user is created, you will be prompted to download a CSV file that contains the user's access key ID and secret access key. This information is crucial for programmatic access.
  3. Store Access Key ID and Secret Access Key Securely:

    • Ensure that you store the access key ID and secret access key securely. Never share the secret key and avoid hardcoding it in your code.
  4. Use Access Key ID and Secret Access Key in Your Code:

    • In your code or scripts, you will use the access key ID and secret access key to authenticate requests to AWS services programmatically.

AWS CLI:-

The AWS Command Line Interface (CLI) is a unified tool that provides a command-line interface for interacting with various AWS services. It allows you to manage and configure AWS services directly from the command line, making it a powerful and efficient tool for developers, system administrators, and other users who prefer command-line interfaces.

Here are some key points and basic commands related to the AWS CLI:

Installation:

You need to install the AWS CLI on your local machine. You can find installation instructions for various operating systems here.

Configuration:

After installation, you need to configure the AWS CLI with your AWS credentials. You can do this using the aws configure command, and you will be prompted to enter your AWS access key, secret key, region, and output format.

bashCopy codeaws configure

Basic Commands:

  1. List AWS S3 Buckets:

     bashCopy codeaws s3 ls
    
  2. Copy File to S3 Bucket:

     bashCopy codeaws s3 cp local-file.txt s3://your-bucket/
    
  3. List EC2 Instances:

     bashCopy codeaws ec2 describe-instances
    
  4. Create an EC2 Key Pair:

     bashCopy codeaws ec2 create-key-pair --key-name your-key-name --query 'KeyMaterial' --output text > your-key-name.pem
    
  5. List Lambda Functions:

     bashCopy codeaws lambda list-functions
    

Deploy to AWS Elastic Beanstalk:

bashCopy codeaws elasticbeanstalk create-application-version --application-nam

Today's Task:-

  • Create AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from AWS Console.

  • Setup and install AWS CLI and configure your account credentials/.

Day 42 of #90daysofDevOps

Thanks for reading

Follow me for more about DevOps♾️........

________________________________________________________________________________

#90daysHardChallenge

#Cloudcomputing

#DevOps

#Python

#TrainWithShubham