Connect to GitHub repo

Create the connection to GitHub

Before AppRunner can connect to GitHub, we must set up a connection via the AWS AppRunner console. If you’ve already had an active GitHub connection, you can skip these steps and use that connection ARN.

  • Go to AppRunner console, navigate the Services menu
  • Click Create service button.
  • In the Source panel, choose Source code repository
  • In the Connect to GitHub section, click Add new button to add new GitHub connection.
  • A pop-up dialog will appear:
    • Choose a name for the new connection and fill in the connection name textbox.
    • Click Install another button
    • Follow the on-screen guides to finish the setup, now the created GitHub connection can be used to access the GitHub repository

To get the GitHub connection ARN, navigate to the GitHub connection menu in the AppRunner console, on the table listing all connection, click the copy icon button in the ARN column of the connection that we want to use. The copied ARN is in this format: arn:aws:apprunner:<region>:<aws account id>:connection/<connection name>/<random hash>

Initialization

cd src/github

# Create the .env file from the sample
cp .apprunner.env.example .apprunner.env
🎯 .apprunner.env

Apply the terraform plan

Run the script to create the AppRunner service with Terraform

./run.sh apply

Possible output:

...
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

app_url = "8h5q2y87mf.ap-northeast-1.awsapprunner.com"

We can see the service running by visit output app_url: https://8h5q2y87mf.ap-northeast-1.awsapprunner.com

Sample service screenshot

Cleanup

Run the script to destroy the deployed stack.

./run.sh destroy