Deploying ASG Instances: What You Need to Know

Prerequisites

AWS IAM Role

Repository

Tools

pip install virtualenv

Deploying Service

It’s different than using Jenkins to build things; every time you merge to master, everything will be available to you if everything goes smoothly. Merging Pull Request to master will trigger CodeBuild to build our service binary (actually, not binary, but production asset), and bake an AMI for you. AMI stands for Amazon Machine Image; it’s a pre-built machine that will be deployed to ASG instances.

To start the deployment process, initiate with the following command:

cd /path/to/pay-ansible-playbook/deployment
source virtualenv.sh

Ensure that your command line has (virtualenv-container) prefix, indicating that the virtual environment has been successfully created. Refrain from continuing if this step failed.

Authentication

Login to AWS using your Google account by executing this command and following the instructions.

aws-google-auth -p saml

Deployment

# Staging
awsudo -u deployer-stg -- ansible-playbook payod-fe/staging.yml -e ami_id=<your-AMI-id>

# Production
awsudo -u deployer-prod -- ansible-playbook payod-fe/production.yml -e ami_id=<your-AMI-id>

Checking Deployment Status

Common Failures