Gitlab CI for deploying to AWS


I have a GitLab pipeline that will deploy multiple cloud formation template to AWS. How do we make sure that a job starts only after the previous cloud formation template creation is complete? Is there a way to do it?


Hi @Sivaraman_Selvam
if you are using AWS CLI you can use aws cloudformation wait stack-create-complete --stack-name SOME_STACK to wait for the deployment to finish successfully. I guess SDK has similar function.

In AWS CLI something like this

aws cloudformation create-stack --stack-name "vpc-stack"

echo "Waiting for stack to be created ..."
aws cloudformation wait stack-create-complete --stack-name "vpc-stack"

Just make sure your GitLab Job time limit is high enough so the Job won’t get canceled before stack is deployed. Limit defaults to 1 hour and can be changed in Project settings.

1 Like