Blueprint to deploy an application on AWS App Runner using terraform
- Install the AWS Connector for Github. This is necessary for AWS to able to pull the code of the application you want to deploy.
- Copy
dev.tfvars.exampletodev.tfvarsand fill in the variables make initto initialize terraform and the two environments (prod and dev)make deploy_devto deploy the application
Error: You might get the following error if you have not finished connecting your AWS account to GitHub:
Error: error waiting for App Runner Service creation: unexpected state 'CREATE_FAILED', wanted target 'RUNNING'. last error: %!s(<nil>)
Solution: This problem is due to an uncompleted handshake between AWS and Github. Go to the AWS App Runner console and click on Github Connections.
The connection you created for this application will be there showing status Pending Handshake. Select that connection and click the Complete Handshake button. After that you can try to redeploy the application again.
AWS_REGION: The AWS Region where to deploy the application. Currently only 5 regions are supported (us-east-1, us-east-1, us-west-2, ap-northeast-1, eu-west-1) Default:us-east-1.AWS_PROFILE: AWS Profile to use for the deployment. Default:defaultPUBLIC_SUBNET_AVAILABILITY_ZONE: Availability zone of the subnet where the app runner application is going to be deployed. Default:us-east-1aAPPRUNNER_SERVICE_NAME: The name that you would like to give to the service. Mainly for recognize it within the AWS console. No defaultAPPRUNNER_CONNECTION_NAME: The name of the connection to the software repo provider. Currently App Runner only support connections to GitHub.APPRUNNER_CODE_REPO: The URL of the repo where to pull the code from.APPRUNNER_CODE_BUILD_COMMAND: The commands to build the application. e.g: In case of react it would benpm install && npm run buildAPPRUNNER_CODE_START_COMMAND: The command or set of command to start the applicaiton. e.g: In case of react it would benpm startAPPRUNNER_CODE_RUNETIME: The runtime needed to run the applications. Accepted values: PYTHON_3, NODEJS_12, NODEJS_14, NODEJS_16, CORRETTO_8, CORRETTO_11, GO_1, DOTNET_6, PHP_81, RUBY_31APPRUNNER_CODE_PORT: The port where the application is listening. Default:3000APPRUNNER_CODE_RUNTIME_ENVIRONMENT_VARIABLES: A map of environment variables to be passed to the application.
