Skip to content

Instantly share code, notes, and snippets.

@rossta
Last active August 29, 2015 14:20
Show Gist options
  • Save rossta/a822b4c631b4e1c82828 to your computer and use it in GitHub Desktop.
Save rossta/a822b4c631b4e1c82828 to your computer and use it in GitHub Desktop.
Introduction to AWS OpsWorks

Intro to AWS OpsWorks for the Rails Developer

AWS OpsWorks

AWS OpsWorks features an integrated management experience for the entire application lifecycle including resource provisioning, configuration management, application deployment, monitoring, and access control. It will work with applications of any level of complexity and is independent of any particular architectural pattern.

Wat?

  • Configure instances
  • Automate provisioning
  • Deploy app

How it fits in the AWS ecosystem:

services

tl; dr - like EngineYard but less opaque **

Why?

Similar surface area to EngineYard. For the developer with EY experience, there are potential pros and cons of switching a production application to OW.

Pros

  • EY + more flexibility and control
  • Cheaper than EY: roughly $1k/month + %10 ... for same instances + AWS Business-level support
  • Additional features like auto-healing and auto-scaling
  • More easily virtualizable **

Cons

  • More control => more responsibility
  • Usage Gotchas? unknown
  • Learning curve/How to? (snapshots, security updates, ssh keys, etc)
  • Quality of Support? unknown
  • Maintenance effort? unknown

Vocabulary

Basic App

php stack 2

Multiple layers

php stack 3

Load Balancing

php stack 4

Overview

overview

Dashboard

instances

Base Cookbooks

ow cookbooks

Customize with custom cookbooks and json

custom cookbook dashboard

Anatomy of a custom cookbook repo

cookbooks

Example custom chef json

{
  "deploy": {
    "simple-php": {
      "application_type": "php",
      "document_root": "web",
      "scm": {
        "scm_type": "git",
        "repository": "dev/simple-php"
      },
      "memcached": {},
      "database": {
        "host": "10.10.10.20",
        "database": "simple-php",
        "username": "root",
        "password": "correcthorsebatterystaple",
        "reconnect": true
      }
    }
  },
  "mysql": {
    "server_root_password": "correcthorsebatterystaple",
    "tunable": {"innodb_buffer_pool_size": "256M"}
  },
  "opsworks": {
    "layers": {
      "php-app": {
        "instances": {
          "php-app1": {"private-ip": "10.10.10.10"}
        }
      },
      "db-master": {
        "instances": {
          "db-master1": {"private-ip": "10.10.10.20"}
        }
      }
    }
  },
  "opsworks_custom_cookbooks": {
    "enabled": true,
    "scm": {
      "repository": "ops/cookbooks"
    }
  }
}

Time-based Scaling

time scale

Load-based Scaling

load scale

Monitoring

ow monitoring

Security and Permissions via IAM

iam

Vagrant

Create and configure lightweight, reproducible, and portable development environments

Wat?

  • Virtualize linux environment on Mac (any) host
  • OpsWorks tools and Chef recipes baked into the image
  • Use cases:
    • Development
    • Deployment

Why?

Using Vagrant

  • $ vagrant up
  • $ vagrant ssh
  • $ vagrant provision or $ vagrant reload --provision
  • $ vagrant halt

flow diagram

Within guest:

  • rails app repo synced to /vagrant for development.
  • deployment and provisioning to /srv/www/platform

Vagrant + OpsWorks

workflow

Resources

** author's opinion

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