Creating AWS Access Keys for IAM and IAM Identity Center Users

Search for a command to run...

No comments yet. Be the first to comment.
Introduction AWS IAM Identity Center is the AWS solution for connecting workforce users to AWS-managed applications and other AWS resources. It allows connecting existing identity providers or managing users directly in IAM Identity Center for user...
Security dashboards are lying to you. That critical CVE flagged in your dependency scan? Odds are, your application never touches the vulnerable code path. The result is alert fatigue, wasted engineer

Harbor is an enterprise-class private container registry with advanced features like RBAC, replication, vulnerability scanning, and more. In this guide, we'll set up Harbor on a Ubuntu machine, secure it with Let's Encrypt certificates, and use Cloud...

Introduction This document provides a step-by-step guide to installing and configuring the AWS CLI and Pulumi on Ubuntu 24.04. Prerequisites Ubuntu 24.04 installed and configured. A user account with sudo privileges. An active AWS account. 1. In...

What motivated me to do this? While reading the book Container Security, a strange question popped into my head. Since everything inside a container is essentially a process running on the host machine's Linux kernel, what about creating nested conta...

This document outlines the procedures for creating AWS Access Keys for both IAM users and IAM Identity Center (Federated) Users. These credentials are used for programmatic access to AWS services, enabling applications and tools to interact with AWS resources.
Log in to the AWS Management Console
Navigate to the IAM Service
Select Users
Choose the IAM User
Go to the Security Credentials Tab
Create Access Key
In the "Access keys" section, click "Create access key."
Choose the use case for the key. For automated access choose "Command Line Interface (CLI)".
Click "Next" then "Create access key".
Store the Access Key and Secret Key
A dialog box will display the Access Key ID and Secret Access Key.
Important: Download the .csv file or copy the keys and store them in a secure location. The Secret Access Key is only displayed once and cannot be retrieved later.
Click "Done".
AWS IAM Identity Center (formerly AWS SSO) allows users to access multiple AWS accounts and applications with a single set of credentials. Here's how to obtain temporary credentials for IAM Identity Center users.
Go to AWS access portal of your AWS organization and follow any of the following option for temporary authentication.
Option 1: Using AWS CLI
To extend the duration of your credentials, it is recommended to configure the AWS CLI to retrieve them automatically using the aws configure sso command.
After running the command, you have to follow these steps:
Give SSO start URL
Give SSO Region
SSO authorization page will pop up in the default browser window. If you're in a server then go to the given URL in your browser and enter the code.
Select the AWS account you want to use.
Specify default region.
Specify output format
Specify profile name
Use aws sso login --profile <PROFILE_NAME> command when session token expires, and you need to login again.
Option 2: Set AWS environment variables
export AWS_ACCESS_KEY_ID="YOUR_AWS_ACCESS_KEY_ID"
export AWS_SECRET_ACCESS_KEY="YOUR_AWS_SECRET_ACCESS_KEY"
export AWS_SESSION_TOKEN="YOUR_AWS_SESSION_TOKEN"
Option 3: Add a profile to your AWS credentials file
~/.aws/credentials). [PROFILE_NAME]
aws_access_key_id=YOUR_AWS_ACCESS_KEY_ID
aws_secret_access_key=YOUR_AWS_SECRET_ACCESS_KEY
aws_session_token=YOUR_AWS_SESSION_TOKEN
--profile aws s3 ls --profile <PROFILE_NAME>
Option 4: Use individual values in your AWS service client
Though getting access keys of IAM user is pretty straight forward, there is a risk of the secrets getting leaked, thus need to rotate regularly. On the other hand, getting access keys of IAM Identity Center user is cumbersome, but it adds security as the credentials are temporary.