Deploy web infrastracture for a hello world go app in AWS
To build infra, first we have to set the environment variables needed to run the scripts
export VPC_ID= export CLUSTER_NAME= export STACK_NAME=
Next we’ll make use of the helper scripts to run the cloudformation script
Creates the cloudformation stack
Updates the cloudformation stack
Deletes the stack
Run the create stack script
./scripts/create-task
Once cloud formation has completed. We can now have access to the Role ARN on the outputs.
Define GHA_ROLE_ARN
on actions secrets or change this line on main.yml
role-to-assume: <your-arn>
Now that arn is set we can trigger the build pushing a commit
touch sample.txt git commit -am "sample"
Once the workflow is done without failures.
We need to update the service DesiredCount
to a value greater than 0
ECSService: Properties: ... DesiredCount: 1
then update the stack
./scripts/update-stack
On update stack complete, go to outputs tab and copy the loadbalancer dns name.
Run the ./scripts/cleanup
if cleanup fails delete the repository on aws console and run the script again