Part 1 is here
Now that we have updated the code lets actually use it. First thing you need to do is download the zip of my repo
Login to your AWS account and create an S3 bucket. I’ll name mine: glitchv0-awx
Unzip the repo and upload the 4 folders into your new bucket. It should look like this when you are done.
Now I’m going to assume you are setting up from scratch and don’t already have a VPC etc that you want to deploy into. Luckily this CloudFormation template will create everything for you, including the VPCs and subnets.
Go into the templates folder on your bucket and click awx-master.template. At the bottom right click the object URL and copy the link. It should look something like this:
Next, we need to create an SSH key pair to associate with the EC2 instances. If you already have one created and ready you can skip this step.
Go to Services > EC2. On the left side menu scroll down to Key Pairs under Network and Security. Click Create key pair in the top right corner. Name it whatever you like and create the key. Make sure you save the key when prompted, you will not get another chance and will have to create a new one if you lose or didn’t save the key.
Go to Services > CloudFormation. Click on Create stack. Paste your URL into the box asking for the S3 URL, hit next.
Give the stack a name, I’ll name mine GV0-AWX. Select the number of AZs you want to use. I’d do at least 2, which 2 is up to you. Next it will have VPC CIDRs and Subnet CIDRs filled out for you. You can change these if you like, I’m going to leave mine at defaults.
In the Allowed Bastion, enter your public IP address so that you can SSH if needed. Make sure you use CIDR notation: 18.104.22.168/32 . You can also put 0.0.0.0/0 if you want it to be wide open (I wouldn’t recommend that). In the Key Pair name, select the key pair you created earlier or your existing if you already had one. The cluster size defaults to 2 but I would change it to 1, you can always scale out later.
Set a DB username and password. Down a bit set the admin username and password for AWX. Finally, in the Quick Start S3 Bucket Name, change that to the S3 bucket you made earlier. Delete the contents of the Quick Start S3 Key Prefix, it isn’t needed in our case.
Click Next. Tags are something I’d highly recommend you do. I’m going tag mine as Name: AWX. Once you’ve added your tags click Next at the bottom.
Almost done, scroll all the way to the bottom and check the two boxes that will allow CloudFormation to do its thing. If you don’t, this won’t work. Once both are check, click Create stack.
That’s it… go to lunch… no, seriously go to lunch, this is going to take a very long time. It takes about 30 to 45 minutes to create everything.
Once it is completed the URL for your new AWX instance in on the outputs tab of the stack.
If you already have an existing VPC and subnets you want to deploy to, then you should follow this slightly different template.
In your S3 bucket, templates folder. Select awx-workload.template, copy the URL at the bottom.
Go to Services > CloudFormation. Click create stack. From here you get to select your existing VPC along with what Public and Private subnets you want to use. The only thing you may want to update I the Amazon RDS Access CIDR. It is set pretty wide open by default and should probably be set the CIDR of your private subnets.
Once you’ve set your settings the rest is like the previous steps. This does still take a while. Like the scratch version the URL will be in the outputs section of the stack.
Go to that URL, login with your credentials you set and you should be greeted with the AWX dashboard. Click the “i” in the upper right corner to display your version.
Congratulations, you now have AWX up and running in AWS. Feel free to visit my site again as I plan on doing more with Ansible/AWX and automation in general.