# Cloud-init script for AWS installation (CentOS 7, Docker local)

**URL:** <https://forum.ansible.com/t/cloud-init-script-for-aws-installation-centos-7-docker-local/25500>\
**Category:** AWX Project\
**Tags:** aws, awx\
**Created:** [September 16, 2017, 4:24pm UTC](https://forum.ansible.com/t/cloud-init-script-for-aws-installation-centos-7-docker-local/25500 "2017-09-16T16:24:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdelaporte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jdelaporte/32/366_2.png) [@jdelaporte](https://forum.ansible.com/u/jdelaporte)\
**Post date:** [September 16, 2017, 4:24pm UTC](https://forum.ansible.com/t/cloud-init-script-for-aws-installation-centos-7-docker-local/25500/1 "2017-09-16T16:24:36Z")

</div>

I just thought I’d share this, since it’s super handy for throwing an AWX host up on a CentOS 7 host on AWS…following the local Docker method with AWX logos. This script can be copied/pasted into “User data” under 3.Configure Instance Details → expand Advanced in the EC2 Launch Instance wizard.

#!/bin/bash

yum install -y [http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm](http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm) --enablerepo=extras

yum install -y ansible vim docker git make python-pip lvm2 --enablerepo=extras

yum update -y

pip install docker-py

pvcreate /dev/xvdf

vgcreate vg\_awx /dev/xvdf

lvcreate -l 100%FREE vg\_awx -n lv\_awx

mkfs.ext4 /dev/vg\_awx/lv\_awx

mkdir /awx

mount /dev/vg\_awx/lv\_awx /awx

echo ‘/dev/vg\_awx/lv\_awx /awx ext4 defaults 0 2’ \>\> /etc/fstab

systemctl start docker

systemctl enable docker

cd /awx

git clone [https://github.com/ansible/awx.git](https://github.com/ansible/awx.git)

git clone [https://github.com/ansible/awx-logos.git](https://github.com/ansible/awx-logos.git)

cd awx/installer

sed -i ‘s/awx\_official=false/awx\_official=true/’ inventory

ansible-playbook -i inventory install.yml

docker logs -f awx\_task

Note: I might have missed something, because I can access the AWX web control panel through http, but not https…I’m not sure why yet, as I am new to Docker and AWX.

---

<div class="post-metadata">

**Author:** ![jdelaporte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jdelaporte/32/366_2.png) [@jdelaporte](https://forum.ansible.com/u/jdelaporte)\
**Post date:** [September 16, 2017, 4:27pm UTC](https://forum.ansible.com/t/cloud-init-script-for-aws-installation-centos-7-docker-local/25500/2 "2017-09-16T16:27:35Z")

</div>

I forgot to mention:  
While provisioning the instance, you will need to create a second volume for sdb…I used 12-20 GB, which worked fine to start playing with.  
You will need to set up Security Group rules that allow you to access the http/https on your instance, and ssh if you want to log in and tail logs.  
You can watch the install process with tail -f /var/log/cloud-init-output.log
