Skip to content

Instantly share code, notes, and snippets.

@deathbearbrown
Last active August 29, 2015 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deathbearbrown/960d4a98f6760243e689 to your computer and use it in GitHub Desktop.
Save deathbearbrown/960d4a98f6760243e689 to your computer and use it in GitHub Desktop.

Setting Up a Remote Server on AWS

Log into WFMU's aws with the credentials that you got from Jeff. Go to EC2 on that insanely cluttered menu, the icon is orange and it's up top on the left.

CREATE AN INSTANCE:
Start an instance by clicking that big blue button:

  • Select your VM image. Most of our apps use an Ubuntu 64-bit image, which is the last option in the list.
  • NEXT: Instance type, use Micro instances (t1.micro) for now and we can change it later :)
  • NEXT: hit review and launch!
  • Ignore the security message. Shut up security message
  • Either use an existing . pem key or create a new one by selecting: "Create a new key pair" & download that and put it in your /.shh
  • Click LAUNCH INSTANCE

Now it's launched, click INSTANCES in the sidebar to see a list of running instances. Give your new instance a name!

ADD AN ELASTIC IP:
Under network & security click on Elastic IP.
Click Allocate New Address to make a new IP.
Associate that IP to your Instance.
Copy that IP down, that's what you're going to use to ssh & in your ansible inventory file to connect to the server.

SECURITY!
In the instance list, scroll to the right to find the Security Groups column, click on the group.
In the tabs that are on the bottom of the screen, click the second one that says INBOUND.
You want to open up some ports so we can assess the server.
You want at least:
SSH - TCP - 22 - 0.0.0.0/0
HTTP -TCP - 80 - 0.0.0.0/0
HTTPS - TCP - 443 - 0.0.0.0/0

NOTE- if you create a new security group you'll have to restart the instance. If you add to an existing one, you won't have to.

With your .pem key in your ~/.ssh folder, chmod 400, check to see if this worked by sshing onto the box: ssh -i ~/.ssh/DATPEMKEY.pem IP.ADD.RESS

ONTO THE ANSIBLE! You need to add one extra roll to everything: COPY

---
# Copy local files over to server

  - name: Copy over the php code
    synchronize: src='../api' dest={{root}} rsync_opts=--exclude=vendor

Then create a new playbook with all your local roles and this new one.

Last thing you gotta do is make a production Inventory File.
In here you need to change 3 things:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment