> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/3.0/use-deployments/overview-5/sam-infrastructure.md).

# SAM infrastructure

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

### What you will learn <a href="#what-you-will-learn" id="what-you-will-learn"></a>

* 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 <a href="#create-an-environment" id="create-an-environment"></a>

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 <a href="#create-an-infrastructure-definition" id="create-an-infrastructure-definition"></a>

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 <a href="#aws-details" id="aws-details"></a>

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 <a href="#simultaneous-deployments" id="simultaneous-deployments"></a>

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 <a href="#scope-to-specific-services" id="scope-to-specific-services"></a>

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 <a href="#next-steps" id="next-steps"></a>

* Go to [SAM services](/continuous-delivery/3.0/use-deployments/overview-5/sam-services.md) to configure the SAM manifest and values file for your service.
* Go to [AWS SAM overview](/continuous-delivery/3.0/use-deployments/overview-5.md) to set up the pipeline that runs the build and deploy steps.

{% @harness-feedback/feedback %}
