An IIHT Company

Setting Up Ubuntu Server 20.04 with AWS CLI on AWS

Managing your AWS services becomes more efficient with the AWS Command Line Interface (CLI). This guide will walk you through the steps to set up an Ubuntu Server 20.04 instance on AWS, install the AWS CLI, and configure it for seamless AWS resource management.

Prerequisites:

An AWS account.
AWS Access Key ID and Secret Access Key.
Step 1: Launch an AWS EC2 Instance

Access the AWS Management Console.
Navigate to the EC2 service.
Create a new instance using the “Ubuntu Server 20.04 LTS” Amazon Machine Image (AMI).
Step 2: Key Pair

During instance creation, either select an existing or create a new key pair to ensure secure SSH access. Save the private key file (*.pem) locally.
Step 3: Connect to Your EC2 Instance

Use SSH to connect to your EC2 instance with the private key file.
bash
Copy code
ssh -i /path/to/your-key.pem ubuntu@your-instance-ip
Step 4: Update and Upgrade

Once connected, update the package list and upgrade installed packages.
bash
Copy code
sudo apt update
sudo apt upgrade
Step 5: Install AWS CLI

Install the AWS CLI with the following command:
bash
Copy code
sudo apt install awscli
Step 6: Configure AWS CLI

Configure the AWS CLI by setting your AWS Access Key ID, Secret Access Key, default region, and output format.
bash
Copy code
aws configure
Follow the prompts to provide the required information.

Step 7: Verify AWS CLI Configuration

Confirm your AWS CLI configuration by executing a simple command, for example:
bash
Copy code
aws ec2 describe-instances
Step 8: Install Additional Tools (Optional)

Depending on your specific needs, you can install additional tools or libraries on your Ubuntu instance.
You now have an Ubuntu Server 20.04 instance on AWS with the AWS CLI installed and configured. You can start leveraging the AWS CLI to manage your AWS resources efficiently. To ensure security, follow AWS best practices, including setting up IAM roles to restrict access and safeguard your AWS resources.