SERVERLESS RUBY
Build and Deploy AWS Lambda Functions from Scratch

Chapter 4: Manually Deploying Your First Ruby Lambda

Let's Ship Some Ruby to the Cloud

Now that your Ruby Lambda function is Dockerized and working locally, it's time to run it in the cloud. No Terraform yet. No CI/CD. Just you, your terminal, and the AWS Console.

In this chapter, you'll manually build and push your Docker image to AWS, then create and run your first Lambda function with it.

The goal is to understand each step, so when we automate later, you'll know exactly what the automation is doing.


🛠 Prerequisites

Make sure you've completed:

  • ✅ Chapter 3 (Dockerized Ruby Lambda built and working locally)
  • ✅ AWS CLI installed → Install Guide
  • ✅ Logged in to AWS CLI via aws configure
  • ✅ Your AWS region (e.g. us-east-1) selected and remembered

🪜 Step 1: Create an Amazon ECR Repository

ECR is AWS's Docker image registry. It's where your Lambda will pull its image from.

  1. Go to the AWS Console → Elastic Container Registry (ECR)
  2. Click Create repository
  3. Name it something like: my-ruby-lambda
  4. Leave the defaults (private repository, no scan or encryption changes)
  5. Click Create

Take note of the repository URI , it'll look something like this:

123456789012.dkr.ecr.us-east-1.amazonaws.com/my-ruby-lambda

🪜 Step 2: Authenticate Docker to ECR

Run this command to log Docker into ECR:

aws ecr get-login-password --region us-east-1 \
  | docker login --username AWS \
    --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com

Replace the region and account ID with your values.

If successful, you'll see:

Login Succeeded

Continue reading with full access

Get unlimited access to Serverless Ruby and learn to build production-ready serverless Ruby applications.
📖
Complete guide with 8 chapters and bonus content
💻
Real-world examples with copy-paste code templates
🎯
Step-by-step tutorial and walkthroughs
Pay once to get full access to the book, including all future updates.