New – AWS Proton Supports Terraform and Git Repositories to Manage Templates

New – AWS Proton Supports Terraform and Git Repositories to Manage Templates

Today we announce the launch of two features for AWS Proton. First, the most in-demand in AWS Proton’s open roadmap for defining and delivering infrastructure using Terraform. Second, the ability to manage AWS Proton templates directly from Git repositories.

AWS Proton is a fully managed application delivery service for containers and serverless applications, announced during reinvent 2020. AWS Proton aims to help infrastructure teams automate and manage their infrastructure without affecting developer productivity. It allows developers to get the templates they need to deliver their applications without having to involve the platform team.

When using AWS Proton, the infrastructure team must define the environment and service templates. Learn more about the templates.

Template synchronization
This new feature in AWS Proton allows the platform team to push, update, and release templates directly from their Git repositories. When you now create a new service or environment template, you can specify an external Git repository that contains the templates. AWS Proton will automatically synchronize these templates and make them available for use. When there are changes to the Git repository, AWS Proton will take care of the updates.

Create environmental template

An important benefit of using repositories and synchronizing the templates is that it simplifies the process for administrators to upload, update and register the templates. This process, when performed manually, can be error-prone and inconvenient. Now you can automate the process of creating and updating the templates. You can also add multiple validations using pull requests and track the changes to the templates.

Template synchronization enables collaboration between the platform team and the developers. By having all the templates in a Git repository, all the available collaboration tools on platforms like GitHub become accessible to everyone. Now developers can see all the templates and when they want to improve them, they can just create a pull request with the changes. In addition, tools such as debuggers and feature requests can be used to manage the templates.

Configuration of Repository Link
To get started using template synchronization, you must grant AWS Proton permissions to access your repositories. To do this, create a link between AWS Proton and your warehouse.

To do this, first create a new source connection to your GitHub account. Then create a new storage link from the AWS proton. Go to the Repositories option in the sidebar. Then in Link new stock screen, use the GitHub connection you just created and enter a storage name.

Create new link store

AWS Proton supports Terraform
Until now, AWS CloudFormation was the only infrastructure as a code (IaC) engine available in AWS Proton. Now you can define service and environment templates based on infrastructure defined using Terraform and through a pull-request-based mechanism, use Terraform to prepare and keep your infrastructure up to date.

Platform teams create their IaC templates in HCL, the Terraform language, and then deliver the infrastructure using Terraform Open Source. AWS Proton renders the Terraform module ready for delivery and makes a pull request to your infrastructure warehouse from which you can plan and apply the changes.

This operation is asynchronous as AWS Proton is not the one managing the delivery of infrastructure. Therefore, it is important that in the process of preparing the infrastructure there is a step that notifies AWS Proton of the status of the implementation.

I would like to show you a demo on how to set up an environment using Terraform. For that, you need GitHub actions to prepare the Terraform infrastructure on your AWS account.

To get started with Terraform templates, you must first configure the repository link as previously described. Then create a new role to grant GitHub actions permissions to perform some activities on your AWS account. You can find the AWS CloudFormation template for this role here.

Create an empty GitHub repository and create a folder .github/workflows/. Create a file called terraform.yml. In that file, you need to define the GitHub actions to plan and apply the infrastructure changes. Copy the template from the terraform sample file.

This template configures your AWS credentials, configures Terraform, plans the entire infrastructure, and applies the infrastructure changes using Terraform, and then notifies AWS Proton of the status of this process.

Additionally, you need to modify the file env_config.json, which is located inside that folder. In that file, add the configuration for the environment you plan to create. You can add new environments to the JSON file. In the example, the environment is called tf-test. The role is the role you created earlier and the region is the region where you want to implement this infrastructure. Look at the sample file.

    “tf-test”: {
        “role”: “arn:aws:iam::123456789:role/TerraformGitHubActionsRole”,
        “region”: “us-west-2”

In this example, you upload the Terraform project to Amazon S3. See an example of a Terraform project.

Now it’s time to create a new environmental template in AWS Proton. You can follow the instructions in the console.

When your environment template is ready, create a new environment using the template you just created. When configuring the environment, select Supply through pull request and then configure the memory with the correct parameters.

Configure new environmentNu, i Environmental details, you can see that the implementation status is in progress. This will remain so until the GitHub action is completed.

Environmental details

If you go to your warehouse, you should see a new pull request. Next to the name of the pull request you will see a red cross, yellow dot or green marking. This icon depends on the status of the GitHub action. If you have a yellow dot, wait until it turns red or green. If there is an error, see what’s going on inside the GitHub action logs.

If you see a green check mark on the pull request, it means that the GitHub actions have been completed and the pull request can be merged. After the pull request is merged, the infrastructure is prepared. Return to the environmental information page. After a while, and once your infrastructure is ready, which may take a few minutes depending on your template, you should see that the implementation status is successful.

Github pull request

At the end of this demo, you have prepared your infrastructure using AWS Proton to handle environmental templates and GitHub actions, and Terraform Open Source to prepare the infrastructure on your AWS account.

Terraform support is available in public preview mode.

These new features are available in the areas where AWS Proton is available: US East (Ohio), US East (N. Virginia), US West (Oregon), Asia Pacific (Tokyo) and Europe (Ireland).

To learn more about these features, visit the AWS Proton service page.



Please enter your comment!
Please enter your name here