Lambda Deployment Overview

Updated 2 weeks ago by Michael Cretzman

Harness has first class support for AWS Lambda deployments, enabling you to deploy your functions without having to worry about compute constraints or complexity.

Walk through this guide in the following order:

  1. Deployment Summary
  2. Delegate and Connectors for Lambda
  3. Services for Lambda
  4. Lambda Environments
  5. Lambda Workflows and Deployments
  6. Verifications and Troubleshooting

Deployment Summary

Setting up a Lambda deployment is as simple as adding your function zip file, configuring function compute settings, and adding aliases and tags. Harness takes care of the rest of the deployment, making it consistent, reusable, and safe with automatic rollback.

For a general overview of how Harness works, see Harness Architecture and Application Components.

Basically, the Harness setup for Lambda is akin to using the AWS CLI aws lambda create-function, update-function-code, and update-function-configuration commands, as well as the many other commands that are needed.

The benefit with Harness is that you can set your Lambda deployment up once with no scripting and then have your Lambda functions deployed automatically as they are updated in your AWS S3 bucket. You can even templatize the deployment Environment and Workflow for use by other devops and developers in your team.

Furthermore, Harness manages Lambda function versioning to perform rollback when needed.

The following list describes the major steps we will cover in this guide:

  1. Delegate - Install the Harness Shell Script or ECS Delegate in your AWS VPC.
  2. AWS Cloud Provider - Add the AWS Cloud Provider. This is a connection to your AWS account. The AWS Cloud Provider can use your user account or the IAM role assigned to the Delegate host.
    The AWS Cloud Provider is used to connect Harness to your Lambda deployment environment and to Amazon S3 to obtain your Lambda code files. You can also use a Custom Artifact Repository, as described in Custom Artifact Source.
  3. Harness Application - Create the Harness Application for your Lambda CD pipeline. The Harness Application represents your Lambda code and functional spec, their deployment pipelines, and all the building blocks for those pipelines. Harness represents your Lambda deployment using a logical group of one or more entities: Services, Environments, Workflows, Pipelines, Triggers, and Infrastructure Provisioners. Applications organize all of the entities and configurations in Harness CD.
  4. Harness Service - Create the Harness Service using the Lambda type.
    1. Set up your Lambda code artifact source, Lambda Function Specification, and any config variables and files.
  5. Harness Environment - Create the Harness Environment containing the Service Infrastructure definition of your AWS deployment environment, and any overrides of Service settings.
  6. Harness Workflow - Create the Basic deployment Harness Workflow. This Workflow will deploy the Service (your Lambda code) to the Environment (your AWS Lambda functions for the region).
    You can also add your Lambda Aliases and Tags as part of the Workflow.
  7. Deploy the Workflow.
  8. Advanced options not covered in this guide:
    1. Harness Pipeline - Create a Harness Pipeline for your deployment, including Workflows and Approval steps. Typically, Harness customers will deploy Lambda Pipelines with a Workflow for Dev, QA, Stage, etc:
      This example doesn't show Approval steps between Pipeline stages, which are also common. For more information, see Pipelines.
    2. Harness Trigger - Create a Harness Trigger to automatically deploy your Workflows or Pipeline according to your criteria. Typically, customers use a Trigger to execute a Lambda Pipeline using the Trigger's On New Artifact condition. Each time the Lambda artifact, such as a zip file, is updated in the artifact repository (AWS S3), the Pipeline is executed and the new Lambda function is deployed.
      For more information, see Triggers.
    3. Harness Infrastructure Provisioners - Create Harness Infrastructure Provisioners, such as CloudFormation and Terraform, for your deployment environments. For more information, see Infrastructure Provisioners.
    4. Continuous Verification:
      1. Deployment Verification - Once you have successfully deployed you can add your APM and logging apps as Verification Providers, and then add Verify Steps to your Workflows. Harness will use its machine-learning to find anomalies in your deployments. For more information, see Continuous Verification.
      2. 24/7 Service Guard - Monitor your live applications, catching problems that surface minutes or hours following deployment. For more information, see 24/7 Service Guard.
Harness fully-integrates with AWS CloudWatch to apply Harness machine learning to CloudWatches monitoring and operational data. See CloudWatch Verification.

What Are We Going to Do?

This guide walks you through deploying a Lambda function to AWS Lambda using Harness. Basically, the Harness deployment does the following:

  1. Lambda function setup - Pull a zip file from AWS S3 and define the function-level settings, such as the function runtime, memory size, and handler.
  2. VPC settings - Define the VPC settings for the Lambda deployment.
  3. Versioning and tags - Add any aliases and tags to the Lambda function.
  4. Deploy - Deploy the Lambda function to an AWS VPC.

What Are We Not Going to Do?

This is a simple guide that covers the basics of deploying Lambda functions to AWS. It does not cover the following:

  • Teaching AWS Lambda.
  • Using all the Lambda runtimes. We will be using a Node.js example. The steps are the same for all the Lambda runtimes.

Before You Begin

The following are required:

  • AWS account - An AWS account you can connect to Harness.
  • Harness Delegate - A Harness Shell Script or ECS Delegate installed in your AWS VPC that can connect to your S3 bucket and Lambda.

We will walk you through the process of setting up Harness with a connection to AWS, and the Harness Delegate installation is summarized also.

Next Step


How did we do?