Installing and Setting Up AWS CLI and Pulumi on Ubuntu 24.04

Search for a command to run...

No comments yet. Be the first to comment.
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...

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...

Introduction 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 inter...

This document provides a step-by-step guide to installing and configuring the AWS CLI and Pulumi on Ubuntu 24.04.
Ubuntu 24.04 installed and configured.
A user account with sudo privileges.
An active AWS account.
Step 1.1: Update Package Lists
First, ensure your system's package lists are up to date:
sudo apt update
Step 1.2: Install pipx (if necessary)
Check if pipx is installed:
pipx --version
If pipx is not installed, install it using apt:
sudo apt install pipx
pipx ensurepath
source ~/.bashrc
Step 1.3: Install AWS CLI using pipx
Install the AWS CLI using pipx:
pipx install awscli
Step 1.4: Verify Installation
Verify the installation by checking the AWS CLI version:
aws --version
This command should display the installed AWS CLI version.
Step 1.5: Configure AWS CLI
Configure the AWS CLI with your AWS credentials. You will need your AWS Access Key ID, Secret Access Key, and Session Token (if using temporary credentials). For details on obtaining these credentials, check out this blog.
aws configure
You will be prompted to enter the following information:
AWS Access Key ID: Your AWS Access Key ID.
AWS Secret Access Key: Your AWS Secret Access Key.
Default region name: The AWS region you want to use by default (e.g., ap-southeast-1).
Default output format: The output format (e.g., json, text, table).
For AWS Session Token, run the following command:
aws configure set aws_session_token <YOUR_SESSION_TOKEN>
Step 2.1: Install Pulumi using the Installation Script
Pulumi provides an installation script that simplifies the process. Run the following command:
curl -fsSL https://get.pulumi.com | sh
This script will download and install Pulumi.
Step 2.2: Add Pulumi to Your PATH
The installation script adds Pulumi to your PATH.
However, if it doesn't, you can manually add it by adding the following line to your ~/.bashrc file:
export PATH=$PATH:~/.pulumi/bin
Then, apply the changes by running:
source ~/.bashrc
Step 2.3: Verify Installation
Verify the installation by checking the Pulumi version:
pulumi version
This command should display the installed Pulumi version.
Step 2.4: Configure Pulumi for AWS
Pulumi uses your AWS CLI credentials by default. If you have already configured the AWS CLI, Pulumi will use those credentials.
If not, you can configure Pulumi to use specific AWS credentials by setting environment variables:
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
export AWS_REGION="YOUR_AWS_REGION"
Replace YOUR_ACCESS_KEY_ID, YOUR_SECRET_ACCESS_KEY, YOUR_SESSION_TOKEN, and YOUR_AWS_REGION with your actual AWS credentials and region.
Step 2.5: Create a Pulumi Account (Optional but Recommended)
While Pulumi can work with local state files, it's highly recommended to create a Pulumi account for state management, collaboration, and other features.
Visit the Pulumi website (pulumi.com) and create an account.
Log in to your Pulumi account from the command line:
pulumi login
To run Pulumi locally without login, use --local flag:
pulumi login --local
In this case all the state data will be stored locally under ~/.pulumi/ directory.
You have now successfully installed and set up AWS CLI and Pulumi on your Ubuntu 24.04 system. You can now use these tools to manage your AWS resources efficiently.