the echo service AMIs

Our main infrastructre is configured and ready, we can now prepare the first steps to deploy our service

1. Goals

The mission is to create our echo services AMIs with Packer.

We are going to create 2 AMIs:

In both cases:

Go here to see how Ansible will use the bastion to create and provision hosts.

2. Packer for socat

To create the AMI, you will need to replace the following Packer command-line parameters:

  • my_vault_a_deploy_echo_role_password: this is the password of the a-deploy-echo-role user
  • my_echo_socat_version: this is the version of our socat service

  • my_ami_region: this is where Packer will work

  • my_ami_regions: this is where Packer will copy all its AMIs

You have to put the regions you have chosen in the previous page.

[bastion] (ansible_virtualenv) ~/
$ cd ~/ansible_playbooks/echo

[bastion] (ansible_virtualenv) ~/ansible_playbooks/echo
$ packer build -var "my_ami_region=eu-west-3" -var "my_ami_regions=eu-west-3,eu-west-1" \
-var 'my_vault_a_deploy_echo_role_password=CHANGE_WITH_DEPLOY_ECHO_ROLE_PASSWORD' \
-var "my_echo_socat_version=1.0.0" \
AWS_socat.packer

We are versioning our socat service because we want to test a blue/green deployment.

You will need this version number a bit later.

This could take at least 15 minutes, so coffee break!

3. Packer for haproxy

To create the AMI, you will need to replace the following Packer command-line parameters:

  • my_vault_a_deploy_echo_role_password: this is the password of the a-deploy-echo-role user
  • my_echo_haproxy_lb_monitor_path: this is a path that will be used by the AWS ELB and Cloudflare’s monitors to check the service is running

  • my_ami_region: this is where Packer will work

  • my_ami_regions: this is where Packer will copy all its AMIs

You have to put the regions you have chosen in the previous page.

[bastion] (ansible_virtualenv) ~/ansible_playbooks/echo
$ packer build -var "my_ami_region=eu-west-3" -var "my_ami_regions=eu-west-3,eu-west-1" \
-var 'my_vault_a_deploy_echo_role_password=CHANGE_WITH_DEPLOY_ECHO_ROLE_PASSWORD' \
-var "my_echo_haproxy_lb_monitor_path=/XXXX" \
AWS_haproxy.packer

This could take at least 15 minutes, so coffee break!

4. Next page!

We are done, let’s create our “echo” infrastructure