Two scenarios are provided:
- Public
- Public with VPC Connector
Create the ECR and other modules:
terraform -chdir="infra" init
terraform -chdir="infra" apply -auto-approve
Now, build and push the Java application to ECR:
(cd ./apps/java; bash ./ecrBuildPush.sh)
Create the .auto.tfvars
file:
touch infra/.auto.tfvars
Set the instance type:
# Choose one
app_runner_workload = "PUBLIC"
app_runner_workload = "PUBLIC_WITH_VPC"
Apply again to create the App Runner instance:
terraform -chdir="infra" apply -auto-approve
Testing the Java service:
curl https://<service-id>.us-east-2.awsapprunner.com/actuator/health
Build and run the image:
docker build -t javaapp-local .
docker run --rm -p 8080:8080 -e OBSERVABILITY_ENABLED=1 -e XRAY_LOGGING_LEVEL=INFO -e OTEL_JAVAAGENT_DEBUG=false -t javaapp-local
Destroy the resources when done:
terraform -chdir="infra" destroy -auto-approve