Hello App Runner in Terraform

Last week AWS launched a new service called App Runner. In their words:

AWS App Runner makes it easier for you to deploy web apps and APIs to the cloud, regardless of the language they are written in, even for teams that lack prior experience deploying and managing containers or infrastructure. The service has AWS operational and security best practices built-it and automatically scale up or down at a moment’s notice, with no cold starts to worry about.

Justin Garrison wrote a sample application called Hello App Runner and published it to a public ECR repository.

Hashicorp added support for the new service on launch day to Terraform to enable easy management of your App Runner services as code. I figured mashing these two together would give me an easy way to take the service for a test run!

Set up an autoscaling configuration

First you set up an autoscaling configuration which your service will use to scale up and down:

Configure the service

Now for the fun part — setting up the service:

Terraform Plan

With those resources in place, you can run a terraform plan to see what will be created:

Terraform Apply

If everything in the plan looks good, you can run terraform apply. A couple of minutes later your service should be up and running!

Wrap up

Once the apply wraps up, you should have a public endpoint up and running. You can grab it from the output — in this case (no guarantees that my endpoint will stick around for long):

If you visit the URL you will see the application page:

I was impressed with how easy it was to get this basic application up and running using Terraform. I’m looking forward to seeing how the App Runner service evolves over time — here’s the public roadmap. My wishlist items are:

Operations Engineer @WaveHQ.