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.
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>
cd src/github
# Create the .env file from the sample
cp .apprunner.env.example .apprunner.env
Update the values here to fit your requirements
aws_region=ap-northeast-1
github_connection_arn="arn:aws:apprunner:ap-northeast-1:xxxxxxxxxxxx:connection/github/xxxxxx"
github_code_repo_url="https://github.com/hieule-labs/hello-app-runner"
aws_region
: the region to run the stack, default to Tokyo (ap-northeast-1
).github_connection_arn
: the ARN of the GitHub connection that used to access the GitHub repository. The connection is created in the previous step.github_code_repo_url
: the GitHub repository URL, the GitHub connection must allow AppRunner to read this repository.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
Run the script to destroy the deployed stack.
./run.sh destroy