Skip to content

Instantly share code, notes, and snippets.

@lukevers
Forked from till/WIP.md
Created October 28, 2016 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukevers/7137d284059d0093e1fd2704cff2d5dc to your computer and use it in GitHub Desktop.
Save lukevers/7137d284059d0093e1fd2704cff2d5dc to your computer and use it in GitHub Desktop.
OpsWorks + DigitalOcean = ❤️
#cloud-config
packages:
- python-pip
write_files:
- path: /root/.aws/credentials
owner: root:root
permission: 0600
content: |
[default]
aws_access_key_id = YOUR_AWS_KEY
aws_secret_access_key = YOUR_AWS_SECRET_ACCESS_KEY
runcmd:
- apt-get autoremove
- pip install awscli==1.7.26
- /usr/local/bin/aws opsworks register --infrastructure-class on-premises --region us-east-1 --stack-id YOUR_STACK --local

Register a droplet in AWS OpsWorks

AWS Requirements

  • create a new IAM user and attach the AWS OpsWorks Register Policy
  • for testing: create a new stack on AWS OpsWorks and fetch its ID
  • customize all variables prefixed with YOUR_ from the cloud-config.yml

DigitalOcean

  • start process to create a droplet
  • put in hostname, select the Ubuntu 14.04 image
  • paste the cloud-config.yml into the user-data field
  • confirm and wait for the droplet to appear on OpsWorks

Did it work?

When you log into your droplet the MOTD should look like this:

$ ssh root@public-droplet-ip
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-52-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Fri May 15 08:39:20 EDT 2015

  System load: 0.0               Memory usage: 9%   Processes:       50
  Usage of /:  7.5% of 19.56GB   Swap usage:   0%   Users logged in: 0

  Graph this data and manage this system at:
    https://landscape.canonical.com/

 This instance is managed with AWS OpsWorks.

   ######  OpsWorks Summary  ######
   Operating System: Ubuntu 14.04.2 LTS
   OpsWorks Instance: name-of-your-droplet
   OpsWorks Instance ID: random hash
   OpsWorks Layers: 
   OpsWorks Stack: stackname
   Public IP: public-droplet-ip
   Private IP: private-droplet-ip

 Visit http://aws.amazon.com/opsworks for more information.

Fin

That's all! Go #multicloud!

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