Again that mail about the need of rotating the Github Tokens of your pipelines?

Teracloud
2 min readOct 15, 2021

“CodeStar Connect” will release you of that pain.

Everybody knows the inconvenience of working with secrets like Tokens or Webhooks: You need to create them, save them in the Parameter Store to avoid leakage, and rotate them every couple of months. But now, using CodeStar connections and the Github App on AWS you are completely free of them! Read this tip form our Teracloud expert.

Again that mail about the need of rotating the Github Tokens of your pipelines / CodeStar Connect will release you of that pain

Creating this connection is as simple as you can see in this link; however, in Terraform you will find that it’s as easy as in the AWS Management Console!

You just need to create your codestar_connection:

To copy and paste: resource “aws_codestarconnections_connection” “github” { name = “pipeline-github-connection” provider_type = “GitHub” }

After applying, the connection will be on Pending status:

Staging connection

You need to update the status by enabling the connection manually. You will be redirected to the connection settings, where you must allow GithubApp to connect the repo with AWS (if it’s the first time, only the organization or repo owner can set this connection). You can connect all your repos or just one:

Request AWS Connector For Github

Once the connection is established you just need to update the source stage on your CodePipeline:

To copy and paste: stage { name = “Source” action { name = “Source” category = “Source” owner = “AWS” provider = “CodeStarSourceConnection” version = “1” output_artifacts = [“source”] configuration = { ConnectionArn = aws_codestarconnections_connection.github.arn FullRepositoryId = var.repo_path BranchName = var.repo_branch } } }

And that’s it!, you can run your Pipelines as usual, but no longer being worried about the need of updating the Github token!

This solution also applies to Bitbucket repos!

You can find more info about configuration here:

https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html
https://docs.aws.amazon.com/dtconsole/latest/userguide/connections.html

Teracloud is an AWS Advanced Consulting Partner specialized in Cloud Computing (AWS, Azure, GCP) best practices. We help SaaS of different industries around the world scale their business safely.

Contact our team at info@teracloud.io for an assessment. Let us handle migration, automation, deployment, performance, cost optimization and machine learning to make your business grow.

We make the cloud easy for you!

--

--

Teracloud

Our thoughts on everything Cloud, Expanding knowledge on our expertise and services