AWS CloudFormation infrastructure provisioning
This tutorial focuses on the usage of AWS CloudFormation as an Infrastructure-as-a-code tool to provision Harness infrastructure within a Harness pipeline.
Provision with CloudFormation Create Stack
This tutorial will provision resources in a Custom stage using the CloudFormation Create Stack step.
Before you begin
Verify that you have the following:
- A Kubernetes cluster in CloudFormation: Create a stack in CloudFormation to provision an EKS cluster to be used as deployment infrastructure.
- Obtain GitHub personal access token with the repo scope. See the GitHub documentation on creating a personal access token.
- Fork the harnesscd-example-apps repository through the GitHub website, which contains the CF template file.
- A functioning Harness pipeline that deploys an application on your cluster using a manifest. Please follow this get started tutorial to set it up.
Get started
- Log into Harness.
- Select Projects, and then select Default Project.
Secrets
- Under Project Setup, select Secrets.
- Select New Secret, and then select Text.
- Enter the secret name
harness_gitpat
. - For the secret value, paste the GitHub personal access token you saved earlier.
- Select Save.
AWS connector
- Copy the contents of aws-connector.yml.
- In your Harness project in the Harness Manager, under Project Setup, select Connectors.
- Select Create via YAML Builder and paste the copied YAML.
- Replace the
accessKey
placeholder with the AWS access key for the AWS user you created (with the required policies). - Add the permananet secret key in
secretKeyRef
. - Here we assume the
region
for secret key to beus-east-1
. Please replace it with the appropriate region. - Add an active delegate under the
delegateSelectors
. - In
projectIdentifier
, replace with the project identifier with yours, for example,default
. - Select Save Changes and verify that the new connector named harness_awsconnector is successfully created.
- Finally, select Connection Test under Connectivity Status to ensure the connection is successful.