Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

How to aws cli authenticate with AWS

Posted on February 18, 2025February 18, 2025 By nim No Comments on How to aws cli authenticate with AWS

To authenticate with AWS using the AWS Command Line Interface (CLI), you have several methods available, depending on your needs and configuration. Below are the primary methods for authentication:

Contents

Toggle
  • 1. Using IAM User Credentials
    • Steps:
  • 2. Using IAM Identity Center (SSO)
    • Steps:
  • 3. Using Environment Variables
    • Required Variables:
    • Example:
  • Summary

1. Using IAM User Credentials

This is a common method for individuals or applications that need direct access to AWS services.

Steps:

  • Create an IAM User:
  • Go to the AWS Management Console, navigate to IAM, and create a new user.
  • Attach the necessary permissions to the user.
  • Generate Access Keys:
  • In the IAM console, select your user, go to the “Security credentials” tab, and create a new access key. This will provide you with an Access Key ID and a Secret Access Key[3][5].
  • Configure AWS CLI:
  • Open your terminal and run:
    bash aws configure
  • Enter the Access Key ID, Secret Access Key, default region, and output format when prompted[4][7].

2. Using IAM Identity Center (SSO)

For organizations using IAM Identity Center (formerly AWS SSO), this is a more secure method.

Steps:

  • Configure SSO:
  • Ensure you have set up IAM Identity Center in your AWS account.
  • Run the Configuration Wizard:
  • In your terminal, execute:
    bash aws configure sso
  • Follow the prompts to set up your profile for SSO authentication[1][8].
  • Login via CLI:
  • Use the following command to log in:
    bash aws sso login --profile my-profile
  • Replace my-profile with the name of your configured profile[1].

3. Using Environment Variables

You can also set environment variables for quick access without modifying configuration files.

Required Variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • Optionally, AWS_SESSION_TOKEN if using temporary credentials.

Example:

export AWS_ACCESS_KEY_ID=your_access_key_id
export AWS_SECRET_ACCESS_KEY=your_secret_access_key
export AWS_SESSION_TOKEN=your_session_token # if applicable

Summary

The choice of authentication method largely depends on your use case—whether you’re an individual developer or part of an organization leveraging SSO. For most users, configuring IAM user credentials is straightforward, while IAM Identity Center offers enhanced security for team environments. Always ensure that you manage your access keys securely and follow best practices for AWS credential management.

Citations:
[1] https://docs.aws.amazon.com/signin/latest/userguide/command-line-sign-in.html
[2] https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-configure.html
[3] https://docs.aws.amazon.com/cli/v1/userguide/cli-authentication-user.html
[4] https://wellarchitectedlabs.com/common/documentation/aws_credentials/
[5] https://blog.gruntwork.io/a-comprehensive-guide-to-authenticating-to-aws-on-the-command-line-63656a686799
[6] https://www.youtube.com/watch?v=cf9mI3eVf2U
[7] https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-authentication.html
[8] https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html


AWS - Amazon Web Service

Post navigation

Previous Post: [EKS/ S3 Mount Point] Create a Persistent Volume on EKS using an S3 Bucket.
Next Post: [Golang / EKS] Accessing AWS EKS with Go: A Comprehensive Guide to Interacting with Kubernetes APIs

More Related Articles

[AWS] Looking into IAM Role and Assume Role in AWS AWS - Amazon Web Service
[EFS/EKS] Warning: config file does not have retry_nfs_mount_command item in section mount… AWS - Amazon Web Service
[EKS]networkPlugin cni failed to set up pod “pod—xxxxx” network: add cmd: failed to assign an IP address to container AWS - Amazon Web Service
[Terraform] – Terraform Beginner – Lesson 6: Terraform Import, Tainting Resources, and Debugging AWS - Amazon Web Service
[aws] AWS refund AWS - Amazon Web Service
[AWS] Saving your secret on AWS Systems Manager – Parameter Store AWS - Amazon Web Service

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Laravel] Laravel Helpful June 26, 2025
  • [VScode] Hướng dẫn điều chỉnh font cho terminal June 20, 2025
  • [WordPress] Hướng dấn gửi mail trên WordPress thông qua gmail. June 15, 2025
  • [Bitbucket] Git Clone/Pull/Push with Bitbucket through API Token. June 12, 2025
  • [Teamcity] How to transfer the value from pipeline A to pipeline B June 9, 2025

Archives

  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.