0
0
AWScloud~30 mins

Configuring credentials in AWS - Try It Yourself

Choose your learning style9 modes available
Configuring AWS Credentials for CLI Access
📖 Scenario: You are setting up your computer to securely access AWS services using the AWS Command Line Interface (CLI). This requires configuring your AWS credentials so the CLI knows who you are and what permissions you have.
🎯 Goal: Configure AWS credentials by creating the necessary files and adding your access keys so you can use AWS CLI commands securely.
📋 What You'll Learn
Create the AWS credentials file with the correct profile and keys
Create the AWS config file with the default region
Use the exact file paths and file names for AWS CLI to recognize
Use the exact profile name default
Use the exact access key ID AKIAEXAMPLE123456
Use the exact secret access key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Set the default region to us-east-1
💡 Why This Matters
🌍 Real World
Setting up AWS credentials is essential for developers and administrators to securely access AWS services from their local machines or servers.
💼 Career
Knowing how to configure AWS credentials is a fundamental skill for cloud engineers, DevOps specialists, and anyone working with AWS infrastructure.
Progress0 / 4 steps
1
Create AWS credentials file
Create a file named credentials inside the ~/.aws/ directory. Add a profile named default with the exact access key ID AKIAEXAMPLE123456 and secret access key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY. Use the exact format shown below:
AWS
Need a hint?

Remember the credentials file must have the profile name in square brackets, then the keys on separate lines.

2
Create AWS config file with default region
Create a file named config inside the ~/.aws/ directory. Add a profile named default and set the region to us-east-1 exactly as shown:
AWS
Need a hint?

The config file uses the profile name in square brackets and the region setting below it.

3
Verify AWS CLI can use the credentials
Write the exact AWS CLI command to check your configured identity using the default profile. Use the command aws sts get-caller-identity --profile default.
AWS
Need a hint?

This command shows your AWS user identity to confirm credentials are working.

4
Set environment variable for AWS profile
Add the exact environment variable AWS_PROFILE and set it to default so AWS CLI uses this profile by default. Use the syntax export AWS_PROFILE=default for Linux/macOS or setx AWS_PROFILE default for Windows.
AWS
Need a hint?

Setting this environment variable saves you from typing --profile default every time.