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

SAM infrastructure

Create Harness environments and AWS SAM infrastructure definitions to target your AWS account and region for SAM deployments.

What you will learn

  • How to create a Harness environment and an AWS SAM infrastructure definition that points to your AWS account and region.

  • How the AWS connector and region you configure are inherited automatically by the SAM Build and SAM Deploy steps.


An infrastructure definition links a Harness environment to the AWS account and region where Harness deploys your SAM application. You create both under Environments and reuse them across pipelines and stages.


Create an environment

You can create an environment from the standalone Environments page or inline while configuring the Environment tab in the pipeline stage wizard. Environment creation follows the same steps for all deployment types.

  1. Go to Deployments and select Environments, or select + New Environment on the Environment tab when setting up a stage.

  2. Enter a name and select an environment type: Pre-Production or Production. The type affects governance policies and deployment dashboards.

  3. Select Save.

Harness opens the environment detail page with Configuration, Infrastructure Definitions, and References tabs.


Create an infrastructure definition

Infrastructure definitions live inside an environment. Each definition points to a specific AWS account and region. You can create one from the environment detail page or inline when selecting an infrastructure on the Environment tab in the pipeline stage wizard.

  1. Open the environment and select the Infrastructure Definitions tab, or select + New Infrastructure on the Environment tab when setting up a stage.

  2. Select + Create Infrastructure.

  3. In the dialog, select AWS SAM from the list.

  4. Enter a name. Harness auto-suggests one; you can change both the name and the ID.

  5. Under Storage, choose Inline or a Git repository.

  6. Fill in the Amazon Web Services Details fields under Provisioner Configuration (see the table below).

  7. Select Save.


Amazon Web Services details

The following fields appear under Provisioner Configuration in the AWS SAM infrastructure definition form.

Field
Required
Description

Connector

Yes

A Harness AWS connector with permissions to create and update CloudFormation stacks and read/write to S3 in the target region.

Region

Yes

The AWS region to deploy to, for example us-east-1. SAM Build and SAM Deploy steps inherit this region automatically.


Simultaneous deployments

By default, Harness queues deployments to the same infrastructure definition to prevent conflicts; the UI shows Simultaneous deployments: False. Set this to True to allow concurrent deployments to the same target.


Scope to specific services

By default, an infrastructure definition is available to any SAM service in the environment. Expand Scope to Specific Services to restrict the definition to a specific set of services. This prevents teams from accidentally targeting the wrong infrastructure.


Next steps

  • Go to SAM services to configure the SAM manifest and values file for your service.

  • Go to AWS SAM overview to set up the pipeline that runs the build and deploy steps.

Last updated

Was this helpful?