Ends in
00
days
00
hrs
00
mins
00
secs
SHOP NOW

📚 Buy any 1 eBook and get another one for FREE!

Guided Lab: Creating AWS Access Keys

Description

Access keys are crucial for providing programmatic access to AWS services via tools such as the AWS CLI, SDKs, or APIs. Each access key consists of an AWS Access Key ID and AWS Secret Access Key linked to an IAM user. These keys allow authorized users to interact with AWS resources such as EC2, S3, DynamoDB, and others without using the AWS Management Console. However, managing these keys carefully is important to prevent unauthorized access.

In this lab, you will use access keys from an existing IAM user, configure them in the AWS CLI, and test their functionality by interacting with an S3 bucket.

Objectives

By the end of this lab, you will:

  • Understand how AWS access keys are used for programmatic access to AWS.
  • Generate access keys for an IAM user.
  • Use the AWS CLI to verify access by listing an S3 bucket.

Lab Steps

Create AWS Access Keys

1. Search for IAM in the AWS console search bar. Select IAM from the list of services to open the IAM Dashboard.

2. In the IAM Dashboard, click Users on the left-hand menu.

3. Select an IAM user to enable MFA.

4. Go to the Security credentials tab.


You can safely ignore the Access Denied Pop-ups. This warning does not affect the process of setting up your access key.


5. Scroll down to the Access keys section and click on Create access key.

6. Follow the following configuration:

a. Use case: Select Command Line Interface (CLI)

b. Check on the Confirmation

      •  Click on Next

c. Description tag value: myCLIAccessKey

      • Click on Create access key

7. After creating the access key, copy the Access key and Secret access key to your clipboard. You can also download the .csv file of it.

Set Up AWS CLI on your Local Machine

Here are the steps for installing the AWS CLI on Ubuntu, and Windows based on the official AWS documentation:

Installation on Ubuntu

Step 1: Download the installation file

Run the following command to download the latest AWS CLI v2 installation file:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

Step 2: Unzip the installer

Ensure you have unzip software installed. If not yet installed, you can install it using:

sudo apt install unzip

Now you can unzip the awscliv2.zip

unzip awscliv2.zip

Step 3: Run the installation

sudo ./aws/install

Step 4: Verify the installation

aws --version

You can now proceed to use the Test Access with AWS CLI STEPS SECTION

Installation on Windows

Step 1: Download the AWS CLI MSI installer for Windows

Go to the AWS CLI installation page and download the installer for Windows:

Step 2: Run the installer

After downloading the MSI file, open it to launch the installation process and follow the on-screen instructions.

Step 3: Verify the installation

Open Command Prompt and type:

aws --version

You can now proceed to use the Test Access with AWS CLI STEPS SECTION

  • You can also simulate a local machine by launching a LINUX EC2 Instance

    NOTE: Amazon Linux Instance are pre-installed with AWS CLI

Launch a Linux EC2 Instance

1. Navigate the EC2 Dashboard.

2.Launch an EC2 Instance using the following configurations:

  • Name: MyWebServer
  • AMI: Amazon Linux
  • Instance type: t2.micro
  • Key pair: (Please create a new one.)
  • Key pair name: myKeyPair
    • Key pair type: RSA
    • Private key file format: .pem
  • Network settings: (Click “Create security group”)
    • Auto-assign public IP: Select Enable
    • Firewall (security groups): tick on the Create security group
      • Ensure that Allow SSH traffic from is checked and is My IP

  • Click Launch Instance.

3. Once the EC2 instance is running, connect via SSH:

ssh -i "your-key.pem" ec2-user@<Public-IPv4-DNS-of-the-ec2-instance>

Test Access with AWS CLI

1. Configure the access keys in the instance by using the AWS CLI:

aws configure

Enter the Access Key ID, Secret Access Key, region as us-east-1 ( you can also leave this blank) , output format ( you can leave this blank)

  • LINUX:

  • UBUNTU:

  • WINDOWS:

2. Create an S3 Bucket

aws s3 mb s3://<unique-bucket-name>
  • LINUX:

  • UBUNTU:

  • WINDOWS:

3. List all S3 Buckets to verify access:

aws s3 ls
  • LINUX:

  • UBUNTU:

  • WINDOWS:

4. Navigate to the Amazon S3 service to verify if the bucket was successfully created.

Congratulations! In this lab, we demonstrated how to create and use access keys for programmatic access to AWS services. We walked through configuring the AWS CLI on an Amazon EC2 instance. After setting up the access keys, we successfully tested their functionality by creating and listing S3 buckets using the AWS CLI. This lab offers a fundamental introduction to securely using access keys for programmatic interaction with AWS resources. Well done!

Skip to content