»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

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></html></body>"
    }
end

»Dockerfile

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

COPY handler.rb /var/task

CMD [ "handler.handler" ]

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

»docker (builder)

Build a Docker image from a Dockerfile.

If a Docker server is available (either locally or via environment variables such as "DOCKER_HOST"), then "docker build" will be used to build an image from a Dockerfile.

»Dockerless Builds

Many hosted environments, such as Kubernetes clusters, don't provide access to a Docker server. In these cases, it is desirable to perform what is called a "dockerless" build: building a Docker image without access to a Docker daemon. Waypoint supports dockerless builds.

Waypoint will automatically attempt a dockerless build if a Docker daemon is not available and no remote Docker server environment variables are set.

Dockerless builds require user namespaces to be enabled. This is a host-level setting that is often not enabled by default. For GKE, you must not use ContainerOS. For AKS (Azure) and EKS (AWS), you must use a custom AMI that has user namespaces enabled. Please search for your distro how to enable user namespaces, it is usually a single line configuration.

»Interface

  • Output: docker.Image

»Examples

build {
  use "docker" {
    buildkit    = false
    disable_entrypoint = false
  }
}

»Required Parameters

These parameters are used in the use stanza for this plugin.

»buildargs

An array of strings of build-time variables passed as build-arg to dockeror img for the build step.

»Optional Parameters

These parameters are used in the use stanza for this plugin.

»build_args

  • Type: map of string to string
  • Optional

»buildkit

If set, use the buildkit builder from Docker.

  • Type: bool
  • Optional

»context

Build context path.

  • Type: string
  • Optional

»disable_entrypoint

If set, the entrypoint binary won't be injected into the image.

The entrypoint binary is what provides extended functionality such as logs and exec. If it is not injected at build time the expectation is that the image already contains it.

  • Type: bool
  • Optional

»dockerfile

The path to the Dockerfile.

Set this when the Dockerfile is not APP-PATH/Dockerfile.

  • Type: string
  • Optional

»Output Attributes

Output attributes can be used in your waypoint.hcl as variables via artifact or deploy.

»image

  • Type: string

»location

  • Type: docker.isImage_Location

»tag

  • Type: string

»aws-ecr (registry)

Store a docker image within an Elastic Container Registry on AWS.

»Interface

  • Input: docker.Image
  • Output: ecr.Image

»Examples

registry {
    use "aws-ecr" {
      region = "us-east-1"
      tag = "latest"
    }
}

»Mappers

»Allow an ECR Image to be used as a standard docker.Image

  • Input: ecr.Image
  • Output: docker.Image

»Required Parameters

These parameters are used in the use stanza for this plugin.

»tag

The docker tag to assign to the new image.

  • Type: string

»Optional Parameters

These parameters are used in the use stanza for this plugin.

»region

The AWS region the ECR repository is in.

If not set uses the environment variable AWS_REGION or AWS_REGION_DEFAULT.

  • Type: string
  • Optional

»repository

The ECR repository to store the image into.

This defaults to waypoint- then the application name. The repository will be automatically created if needed.

  • Type: string
  • Optional

»Output Attributes

Output attributes can be used in your waypoint.hcl as variables via artifact or deploy.

»image

  • Type: string

»tag

  • Type: string

»aws-lambda (platform)

Deploy functions as OCI Images to AWS Lambda.

»Interface

  • Input: ecr.Image
  • Output: lambda.Deployment

»Examples

deploy {
    use "aws-lambda" {
        region = "us-east-1"
        memory = 512
    }
}

»Required Parameters

These parameters are used in the use stanza for this plugin.

»region

The AWS region for the ECS cluster.

  • Type: string

»Optional Parameters

These parameters are used in the use stanza for this plugin.

»iam_role

An IAM Role specified by ARN that will be used by the Lambda at execution time.

  • Type: string
  • Optional
  • Default: created automatically

»memory

The amount of memory, in megabytes, to assign the function.

  • Type: int
  • Optional
  • Default: 265

»timeout

The number of seconds a function has to return a result.

  • Type: int
  • Optional
  • Default: 60

»Output Attributes

Output attributes can be used in your waypoint.hcl as variables via artifact or deploy.

»func_arn

  • Type: string

»id

  • Type: string

»region

  • Type: string

»target_group_arn

  • Type: string

»ver_arn

  • Type: string

»version

  • Type: string

»aws-alb (releasemanager)

Release target groups by attaching them to an ALB.

»Interface

  • Input: alb.TargetGroup
  • Output: alb.Release

»Mappers

»Allow EC2 Deployments to be hooked up to an ALB

  • Input: ec2.Deployment
  • Output: alb.TargetGroup

»Allow Lambda Deployments to be hooked up to an ALB

  • Input: lambda.Deployment
  • Output: alb.TargetGroup

»Required Parameters

This plugin has no required parameters.

»Optional Parameters

These parameters are used in the use stanza for this plugin.

»certificate

ARN for the certificate to install on the ALB listener.

When this is set, the port automatically changes to 443 unless overriden in this configuration.

  • Type: string
  • Optional

»domain_name

Fully qualified domain name to set for the ALB.

Set along with zone_id to have DNS automatically setup for the ALB. this value should include the full hostname and domain name, for instance app.example.com.

  • Type: string
  • Optional

»listener_arn

The ARN on an existing ALB to configure.

When this is set, no ALB or Listener is created. Instead the application is configured by manipulating this existing Listener. This allows users to configure their ALB outside waypoint but still have waypoint hook the application to that ALB.

  • Type: string
  • Optional

»name

The name to assign the ALB.

Names have to be unique per region.

  • Type: string
  • Optional
  • Default: derived from application name

»port

The TCP port to configure the ALB to listen on.

  • Type: int
  • Optional
  • Default: 80 for HTTP, 443 for HTTPS

»subnets

The subnet ids to allow the ALB to run in.

  • Type: list of string
  • Optional
  • Default: public subnets in the account default VPC

»zone_id

Route53 ZoneID to create a DNS record into.

Set along with domain_name to have DNS automatically setup for the ALB.

  • Type: string
  • Optional