For the complete documentation index, see llms.txt. This page is also available as Markdown.

AWS Lambda

Deploy AWS Lambda functions using Harness CD.

An AWS Lambda stage deploys your Lambda function code and configuration to AWS. You define the service (function definition and artifact), the target infrastructure (AWS account and region), and the deployment strategy. Harness manages the rollout and rolls back automatically on failure.


AWS IAM permissions

The IAM role attached to your AWS connector needs the following managed policies:

Policy
Purpose

IAMReadOnlyAccess

Verify required policies

AWSLambdaRole

Invoke the function

AWSLambda_FullAccess

Create and update Lambda functions

AmazonS3ReadOnlyAccess

Pull the function ZIP from S3

AmazonEC2ContainerRegistryReadOnly

Pull a container image from ECR (if applicable)

You also need an AWS Lambda Execution Role configured in your AWS account. Go to AWS Lambda execution role in the AWS documentation to set one up.


Set up a Lambda deployment

  1. Go to Pipelines and click Create Pipeline.

  2. Enter a pipeline name. Under Storage, select Inline or a Git repository. Click Create.

  3. A default Stage 1 is added. You can edit it directly, but the deployment strategy selection step will be skipped. To choose a strategy, delete Stage 1 and click + to add a new stage.

  4. Select Deploy and click Set Up Stage.

  5. Enter a stage name and set Deployment Target to AWS Lambda. Click Next.

The wizard walks you through configuring the service, environment, and execution strategy in sequence.


Service

A service represents what you deploy. For Lambda, it holds the function definition (function name, handler, runtime, memory, and timeout), an optional alias definition for canary routing, the artifact source (S3 ZIP or ECR image), config files, and service-level variables.

Services are independent of pipelines; configure one once and reuse it across stages and pipelines.

Go to Lambda services to configure function definitions, artifact sources, and alias definitions.


Environment and infrastructure

An environment is a logical deployment target such as development, staging, or production. An infrastructure definition within an environment points to the AWS account and region where Harness deploys the function.

The infrastructure definition references an AWS connector, which authenticates to AWS using an IAM role. The connector uses a delegate running in your network to reach the AWS APIs; no inbound access to your environment is required.

Go to Lambda infrastructure to configure environments, infrastructure definitions, and connectors.


Deployment strategies

Harness supports the following Lambda strategies. Select one when you add a stage.

Strategy
What it does

Rolling

Deploys the new function version directly, then shifts 100% of traffic to it immediately.

Canary

Deploys the new version, shifts a configurable percentage of traffic via an alias, then shifts the remainder once validated. Requires an AwsLambdaFunctionAliasDefinition manifest for ZIP artifacts (S3, Artifactory, Nexus); managed automatically for ECR images.


Stage settings

Each stage has settings accessible from the stage editor, organized into sections: Runtime Environment, Inputs & outputs, and Execution controls.


Runtime environment

The Runtime Environment section configures where the stage's steps execute. Harness supports three runtime options:

Runtime
Description

Harness Cloud

Steps run on Harness-hosted infrastructure. No delegate or cluster setup required.

Delegate

Steps run on any installed Classic Delegate or Delegate 3.x (on Harness Cloud for deployments). Harness selects one automatically, or you can inherit from a delegate installed in your environment.

Kubernetes

Steps run as containers on a Kubernetes cluster you specify. Requires a Kubernetes connector and a namespace on the delegate's cluster.

Example — Kubernetes runtime:


Inputs & outputs

The Inputs & outputs section defines the stage's inputs, environment variables, and outputs. Use this section to declare values the stage accepts as runtime inputs, environment variables available to step containers during execution, and outputs the stage exposes to downstream stages.


Execution controls

The Execution controls section sets conditions, looping strategy, concurrency, failure strategy, and timeout for the stage.

On failure defines what Harness does when the stage fails. For Lambda deployments, stage-rollback triggers the rollback step and restores the previous function version.

Strategy configures a looping strategy so the stage runs multiple times across a matrix of values, for example to deploy the same function to multiple regions.


Next steps

Last updated

Was this helpful?