SERVERLESS RUBY
Build and Deploy AWS Lambda Functions from Scratch

Interlude: Installing the AWS CLI

Throughout this guide, you'll need the AWS CLI to authenticate and push images to ECR, create infrastructure with Terraform, or interact with your AWS account. Here's a quick overview on how to set things up in a couple of minutes

On macOS (via Homebrew)

brew install awscli

On Ubuntu/Debian

sudo apt-get update && \
  sudo apt-get install -y awscli

Verify Installation

aws --version

You should see something like:

aws-cli/2.x.x Python/3.x.x ...

Then configure it by running:

aws configure

You'll be prompted to enter your AWS access key, secret access key, region (e.g. us-east-1), and output format.

If you've never created AWS credentials before, here's how:

  1. Navigate to the IAM section in your AWS account
  2. Create a new IAM User
  3. Give them appropriate permissions when prompted
  4. Go to Security Credentials on the user
  5. Click "Create access key"

This will generate an AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY pair for you to use.

About permissions: For production environments, you'll want to keep these narrowly scoped. However, for testing purposes, if you're not familiar with AWS IAM policies, you can temporarily use the AdministratorAccess policy, which gives your credentials full access to your AWS account.

Security reminder: Treat these credentials like any other password or API token. Store them securely and consider removing or changing their permissions once you're done with this guide.