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

CloudFormation provisioning

Provision AWS infrastructure using CloudFormation templates in Harness.

Harness supports AWS CloudFormation as an infrastructure provisioner. You can use CloudFormation templates to provision AWS resources as part of your deployment process.

Harness can provision any AWS resource that is supported by CloudFormation. You can use CloudFormation to provision infrastructure for deployments or to provision any AWS resources on demand.


What you will learn from this topic


Supported deployment types and modes

  • Harness CloudFormation provisioning is supported in the following deployment types:

    • Basic

    • Canary

    • Blue-Green

  • Harness can provision any AWS resource that is supported by CloudFormation.

  • CloudFormation templates must be in JSON or YAML format.

Service Instance licensing

Harness does not consume Service Instances (SIs) when you use CloudFormation for infrastructure provisioning alone, so you can provision infrastructure at no additional licensing cost. SI licensing applies only when Harness deploys an application to the provisioned infrastructure in the same stage or pipeline.

AWS OIDC connector support

CloudFormation provisioning supports AWS connectors with OIDC authentication. This requires Delegate version 854xx or later. For more information, refer to AWS connector settings reference.


Before you begin

  • Harness project access: View, Create/Edit, and Execute permissions on Pipelines, Environments, and Infrastructure Definitions. For more information, refer to RBAC in Harness to configure roles.

  • AWS connector: A Harness AWS connector with permissions to provision resources in your target AWS account. For more information, refer to AWS connector settings reference to configure the connector and review required AWS IAM roles for CloudFormation provisioning.

  • Harness Delegate: A delegate installed in an environment that can connect to AWS. For more information, refer to Delegate installation overview to install a delegate.

  • CloudFormation template: A JSON or YAML CloudFormation template that defines the AWS resources to provision.


Provisioning modes

Harness supports two CloudFormation provisioning modes:

  • Ad hoc provisioning: Provision infrastructure as a standalone task without deploying an application in the same flow.

  • Dynamic provisioning: Provision the target infrastructure and deploy your application to it in the same stage.

The pipeline steps are configured the same way for both modes. Choose the mode that matches your goal: use ad hoc provisioning to manage infrastructure on its own, and dynamic provisioning to provision and deploy in one stage.

For more information, refer to Provisioning overview to understand Harness provisioning concepts and use cases.

Ad hoc provisioning

Ad hoc provisioning lets you provision infrastructure as a standalone workflow without deploying an application in the same flow. This mode is useful to create test environments, set up shared resources, or make infrastructure changes independently of application deployments.

For ad hoc provisioning, add the CloudFormation Create Stack step to the Execution section of a CD Deploy stage. The step provisions your resources when the stage runs.

Example use cases:

  • Provision a shared AWS VPC, subnets, and security groups that other pipelines consume.

  • Stand up a temporary test environment for validation, then destroy it in a later step.

  • Run a one-time infrastructure change defined in a CloudFormation template.

Dynamic provisioning

For dynamic provisioning, add the CloudFormation Create Stack step to the Environment section of a CD Deploy stage and map the CloudFormation stack outputs to the Infrastructure Definition. Harness then deploys your application to the provisioned infrastructure in the same stage.

Example use cases:

  • Provision an AWS EC2 instance and deploy your application to it in a single pipeline.

  • Create ephemeral AWS resources per pull request, deploy to them, and tear them down afterward.

For detailed steps on configuring dynamic provisioning, refer to Provision target deployment infrastructure dynamically with CloudFormation.


CloudFormation steps

Harness provides the following CloudFormation steps for your CD pipelines:


Pipeline examples

The following examples show complete pipeline YAML for ad hoc provisioning and dynamic provisioning using CloudFormation.

Ad hoc provisioning example

This example provisions infrastructure using CloudFormation without deploying an application. The CloudFormation Create Stack step is in the Execution section of the stage.

Ad hoc provisioning pipeline YAML

Dynamic provisioning example

This example provisions infrastructure using CloudFormation in the Environment section. CloudFormation stack outputs are accessible in execution steps. The application is then deployed to the provisioned infrastructure in the Execution section.

CloudFormation dynamic provisioning limitations

CloudFormation does not automatically map stack outputs to infrastructure definition fields (unlike AWS CDK). Infrastructure definitions must be pre-configured in the environment. CloudFormation outputs are accessible in execution steps via expressions.

Dynamic provisioning pipeline YAML

Next steps

Last updated

Was this helpful?