---
layout: plugins
page_title: 'Plugin: AWS Lambda'
description: 'Build, Release, and Deploy on AWS Lambda'
---

# AWS Lambda

## Image Support Only

The AWS Lambda deploy plugin only supports AWS Lambda deployments that utilize ECR images
rather than .zip files.

We recommend that the `docker` build plugin is used to generate these images.

Below is a simple Dockerfile, handler code, and waypoint.hcl for building, deploying, and
releasing using Waypoint.

### handler.rb

```ruby
require 'json'

def handler(event:, context:)
    qs = event.fetch("queryStringParameters", {})

    name = qs.fetch("name", "unknown user")

    STDERR.puts "Handling ALB request for #{name}"

    {
        "statusCode": 200,
        "statusDescription": "200 OK",
        "isBase64Encoded": false,
        "headers": {
            "Content-Type": "text/html"
        },
        "body": "<html><body><h1>Hello there #{name} from Lambda!</h1></body></html>"
    }
end
```

### Dockerfile

```docker
FROM public.ecr.aws/lambda/ruby:2.7

COPY handler.rb /var/task

CMD [ "handler.handler" ]
```

### waypoint.hcl

```hcl
project = "hello"

app "hello-ruby" {
  build {
    use "docker" {}

    registry {
      use "aws-ecr" {
        region = "us-west-2"
        repository = "hello-ruby"
        tag = gitrefpretty()
      }
    }
  }

  deploy {
    use "aws-lambda" {
      region = "us-west-2"
    }
  }

  release {
    use "aws-alb" {

    }
  }
}
```

# Reference

@include "components/builder-docker.mdx"

@include "components/builder-aws-ecr-pull.mdx"

@include "components/registry-aws-ecr.mdx"

@include "components/platform-aws-lambda.mdx"

@include "components/releasemanager-aws-alb.mdx"
