Deploy, Manage, and Scale Your Apps with OpsWorks and Elastic Beanstalk

Just another WordPress site

Deploy, Manage, and Scale Your Apps with OpsWorks and Elastic Beanstalk

good afternoon welcome to the afternoon session for the AWS summits really appreciate you taking the time to join us here today this session is deploy manage and scale your applications with opsworks and Beanstalk and I’m Chris Barclay product manager for ops works and joined here by my colleague Gavin brown community manager for Beanstalk and we’re excited to tell you a little bit about our services today so what are you learn the session we’re going to first start and talk to you about the AWS services that help you manage deploy and scale your applications namely Beanstalk and opsworks we’re going to tell you show you a demonstration of how you can get your applications running on both Beanstalk and opsworks and then finally we’re going to close the session with a discussion about using a TFS cloud formation as a means to document and version control and share your application configurations in a very reliable and robust way so how many folks in the audience either create applications deploy applications or operate applications okay that’s kind of what I expected for folks that came here and so many of you probably have been doing this for a while this probably isn’t the first day you’ve you’ve thought about applications and at least back when I did more more coding I tended to do a lot of things by hand I would log into my my console screen ssh n ID w get my software ID yum install stuff and you know that worked pretty well for you know one vm or a server or two at a time but it was really hard to get that predictable right it was hard to have a process that I knew happen you know happened in the same way every time and if someone asked me to repeat all the steps that I did I’d have to kind of look back through pages of notes and things like that so I you know it’s always good to try to find a way to make your your processes much more repeatable and and reliable and be able to plan for failure and of course it’s not just giving the software onto your instances right it’s all about how do you manage with there might be problems or be able to understand the sorts of challenges that might be happening inside your infrastructure so setting up proper alarms being able to know what things are costing you and so when you look at kind of operating and managing your application it’s a fairly big space and what we want to do is give you tools that you can use to help manage your applications and so Beanstalk and opsworks are two tools that ATO strides to help give you a little bit of a leg up and take away some of that what we call undifferentiated heavy lifting that you’d have to do otherwise to have a nice reliable resilient application so before I jump into the meat of the demonstrations I want to tell you a little bit more about the services themselves so for developers that want to just upload their code and have EWS take care of the rest AWS elastic Beanstalk is a nice service that supports containers such as nodejs Ruby Python and allows you to very easily get your code up into the AWS services and in leverage a lot of our underlying services like ec2 and auto-scaling elastic load balancing if you’re a developer that likes a little more control and you want to be able to customize your environment more then opsworks is a nice solution that gives you automation and control of your application infrastructure and the ability to specify the the container that sees me the layers and configuration of each of your components and then cloud formation helps you simplify the provisioning and management of your infrastructure so I’ll go ahead and turn it over to Evan to take you through elastic Beanstalk thank you Chris and just to echo Chris thanks everyone for joining us this afternoon so again I’m Evan Brown I work on the elastic Beanstalk and cloud formation teams and Chris and I have both developed these two personas that we’re going to talk about in the in the context of elastic Beanstalk and cloud formation or opsworks and then cloud formation and so my persona for Beanstalk is Jane Doe and Jane is a developer so she builds applications and these applications sometimes their web facing front ends they could be api’s and then occasionally Jane has the need to build apps that do background processing so this could be sending an email asynchronously generating a report like a PDF things that don’t really need to be in the request response lifecycle of a web application so those are kind of the three big types of applications that she develops she needs some flexibility to customize the environment that our application runs in so when we think about environment customization this is you know I have a Java app or I have a PHP app and I need to run that in

Apache or and Tomcat but I also need to install new relic for example or some other system library so she wants some some degree of control over her environments and above all else she wants a simple API to deploy manage and scale these applications so I’m going to kick things off with a demonstration so we’re going to do a day in the life of Jane deploying a deploying and managing ap PHP application so it’s a simple PHP app that allows users to store text messages the text messages are stored in a database we’re running the application in this example on elastic Beanstalk and elastic Beanstalk gives us features like elastic load balancing auto scaling managing of our ec2 instances and so on so here’s what we’ll do in the demo and the demo is about 15 minutes I’m going to check the application out from github so this isn’t a public github repo so you all have access to it if you want to run your own web-based text messaging service we’re going to integrate this application with the ebee command-line tool and so EB is a tool that we provide that integrates with elastic Beanstalk and it’s really focused on developers who have workflows that may be command line based and also integrate with git so we’ll talk about how this tool takes sort of lifts your lifts your git deployment workflow and integrates it into elastic Beanstalk we’re going to deploy from the command line we’re going to view the console and manage it and then we’ll do some changes to the application I wore my lucky green demo pants today so I know the demo is going to go off without a hitch just because of the pants so I’m over here in github and will provide this link after the after the demo and this is recorded and the slides will be available but I have this PHP sample application I’m going to copy the URL and I am going to go over into my directory and I’m going to get clone the application locally so we’re sucking the the commits or all of the application history locally and I see that I’ve got my application here that’s good so I talked about EB BB is this command line tool you can install it on Linux Windows or OS 10 and with EB the first thing I need to do is take this this git repository I need to take my application and I need to glue it to elastic Beanstalk I need to define what is the application how should we deploy it so EB an it is the starting point here and EB Anette is going to ask me for my credential so my AWS credentials so I can talk to elastic Beanstalk securely where would we like to deploy the application I’m going to go ahead and deploy this to number two which is Oregon I’m going to give the application a name so this is evans demo app and then we’re going to deploy the application into an environment so an environment is a load balancer an ec2 instance in a database and all of those things so demo app env it’s what’s being suggested here this is a web server that we’re deploying as opposed to a worker which is the other option but we’ll talk about the worker option in the slides here in just a moment and we have the full list of all of the options that you’ve got with elastic beanstalk and it’s a long list but these are sort of the types of applications languages and operating systems that you can choose to deploy you see we’ve got Ruby Python Tomcat Java Windows Server nodejs and then up here is PHP 5.5 so that’s option number two I will select that Beanstalk is or the ebee tool rather is asking me how do you want to employ this we have the option of just a single instance we’ll talk about the use cases for single instance a little bit later but I would like to fully load balance in Auto scaled environment so I’ll choose option number one we would like an RDS database so Bienstock will provision and manage an RDS database for us I don’t have an existing snapshot or backup that I want to use it’s going to be a blank database password is password in this can at this example and if the database gets terminated let’s say we delete the environment Beanstalk is asking hey should we do a backup of the database if you choose to delete the environment and I think backups are good so I’ll take that and then the instance profile we’ll get into that a little bit later as well so at this point my git application on my laptop is configured to deploy to elastic Beanstalk but it’s not actually deployed yet so the next command that we want to run is eb start so eb start says get the application deploy it to beanstalk and fire up the environment inside beanstalk i’m not going to deploy the initial commit yet we’ll come back and do that here in just a bit so right now we’re talking to beanstalk and saying give us a PHP environment build it up so we can deploy an application this isn’t my first rodeo and it’s not

my first cooking show so I know that you don’t put an unbaked pan of brownies into the oven without having another oven that you pull a perfectly baked pan of brownies out to show so while this pan of brownies is baking so this is demo app we’re going to look down at a pan of brownies that I baked this morning so this is a fully deployed version and the brownie should never be green but this is our beanstalk environment that I deployed earlier this morning so now what we want to do is drill in and explore the console and do some deployments and some management of this to this existing application so clicking that green box takes me into the the environment so the environment again is my load balancer my auto scaling group my logs all my monitoring mechanisms and Beanstalk uses the core infrastructure services that AWS provides right so ec2 it’s managing ec2 instances but they are really c2 instances that are in your account and and you own them we’re just sort of distilling this API and saying your web application developer there’s some things that you probably care about and those things we can really kind of enumerate over here the configuration of your app the logs the monitoring the alarms the health of the application the version of the application that’s running so you notice that I’ve got my git commit or the hash of the commit of the application that is running here and I’ve got a nice friendly icon that lets me know and then maybe most importantly is the link to the application so Beanstalk creates a route 53 DNS record for your application and it lets you put a you know a customized name on there but if I were running this you know if this was evans demo app com if I had that domain I can of course slap that customized vanity license plate domain on top of elastic Beanstalk and so customize the experience there so I’m going to click and open up the application and this is actually exactly what I was expecting so the application is built to sort of not work the first time and this index page says in the last sentence that the demo app expects to run from the web document root or the web directory so who has who has changed the document root for a web application before show of hands and then someone can shout out what file do you normally have to change to modify the document root you can shout it Apache HTTP decom yeah so you got the whole slash Etsy slash HTTP D we don’t want to SSH into into these servers right so this particular application is actually running two servers in two different availability zones I don’t want to go look up the IP addresses of those servers and figure out the SSH key and then SSH in and modify a file so this is sort of the first value proposition of elastic Beanstalk and that is we know in this case it’s a PHP application that you’re running and so we know there’s some things that everyone wants about a PHP application so in the configuration panel for this particular environment we have a number of different tiles but I’m going to start with the software configuration tile and this is where we say we talked to PHP developers we know the types of things that you need to control so we’re going to expose some of these common things in this higher-level interface and that first common thing is the document route so I say slash web is my document route I click Save Bienstock is then managing the ec2 instances behind the load balancer and it is configuring them for us dynamically it’s editing the Etsy httpd comp file for us and then we’ll use this as sort of a chance to dive a little bit deeper into what’s happening behind the scenes Bienstock gives us an event log and the event log is really the workflow sort of what’s happening right now what is being stalked doing on my behalf the event log goes back we can control sort of the output level as looks if you’ve written to log files with the with a log tool before these are info levels and we see from the most recent event that it is updating the configuration settings for my environment so I want to toggle back into configuration and talk about what you can do with your config inside this screen and then we’ll come back and look at the the working application so back inside a software configuration we’ve got memory limit if URL F open is enabled if PHP errors should be disabled Mac’s execution so these are lifted up from the PHP ini file or from the Apache file Beanstalk also supports a one click or a toggleable option for log aggregation right it’s the same premise as editing a configuration file you probably don’t want to SSH into each server and find and manage and look at logs it’s just not convenient so Bienstock allows you to enable log rotation and and in this case will

automatically take logs every hour from all of the ec2 instances behind your environment and will store them in s3 you can pull them down from s3 and grep through them you can browse through them in the management console and we’ll take a look at the very end of the demo at some of the files that that get pulled out of log rotation and then finally we have environment properties so environment properties are environment variables that get injected or made available to your application running on the server so the good example I like to use is if I’m using like New Relic or log Lee or some third-party service in my application code and that third-party service requires an environment or requires a credentials to connect to the service environment variables are a really good way to inject that secret information and make it available to the application so I can customize the environment variables that are made available and Bienstock will push them out to all my services so for example I might have New Relic API key and some value we’ll look at a code sample here in a bit that shows you know how you would use Python net or Java to pull these values in from your application code but the key premise here is we’re not putting the New Relic API key or any other API key inside our source code that’s being version controlled because I don’t want my New Relic API key in a public github repository definitely don’t want that to happen so that is flip back here that is the software configuration bit and back into the configuration tiles there’s two more tiles I want to talk about the first is scaling so the scaling tile allows us to control how our application is deployed and in the first example whether or not it’s load balanced or single instance and we can toggle between these two modes and be in stock will provision force correctly in a load balance environment it’s pretty critical that you choose where your applications to play so how many data centers or availability zones so what we’re exposing here is just a very simple form to say I want a minimum of two instances I want a maximum of two instances and this is a particular configuration that I chose for this application how many zones do we want to deploy across and then the scaling trigger so if we say that the minimum is two in the maximum of a is 8 how do we grow and shrink and again it’s one of those things that we shouldn’t have to do manually so this application I’ve decided that it’s CPU bound so the indication that we need more servers is that CPU utilization is going up I’ve set the scaling trigger to average CPU percentage measured over five minutes if that exceeds 70% then I want to add two servers so if CPU goes up average of 70% across the two servers that I have Beanstalk will add two more servers for me maybe equally important especially if you’re architecting an application with cost in mind is you want the scale back in when you don’t have excess load so I’ve set a threshold here somewhat arbitrary for this application but if we’re running at 40% or less CPU let’s take a server away and it will continue to do that until we get to the minimum number of servers to so we’ll never go below that threshold so this gives us this sort of number line to move around in as the CPU requirements or utilization of the application changes and then one more thing in configuration and we’ll get back to the application is we we make it really simple to control the types of ec2 instances that are running here so I’ve got em 1 mediums but if we want it to run C 3 larges or M 3 larges it’s changed the option save the configuration and Beanstalk will redeploy the application servers with those pieces in mind you also do have the ability to enable SSH if you want to and and choose monitoring as well so let’s go back to the dashboard and we’re green so we see that our update changed so we changed the document route we should now see like the functional application running here so I’m going to open this up and this is what we expect to see so this is our basic your thoughts’ application I’ve been running a load tester on this so we’ll look at the load testing and or talk about sort of the metrics that that produces in a bit more detail but if we want to share our thoughts good enough I’m smart enough and how does this end doggonit people like me that’s a Saturday Night Live reference my favorite Saturday Night Live skit so we’ve saved this bit of information to a database we’re going to talk to the database talk about the database piece here in just a bit but now I want to cover the application update workflow so I’ve decided that share your thought with an exclamation point is maybe just a bit much so how do we change the application code how do we develop

locally change locally and then push these changes out into elastic Beanstalk so we’re highlighting the EB tool here today we’ll talk about the other development workflows that are that are an option here in just a few minutes but in the EB workflow I’m going to open up textmate drag this screen over here got it so in the application source I have this thing called app PHP and somewhere down here I set up the the code so I’m going to say penny for your thoughts so that’s the text that shows up remember I’m using git so if I do a git status I see that source app dot PHP has changed I’m going to commit that locally is this being pushed out to Beanstalk now now we haven’t done anything remote we’ve done a local commit but the ebee command-line tool eebee push allows us to take this application take the head commit from the local git repository bundle it up and then we’re going to send it out to elastic Beanstalk so if I alt tab back to the console here in very short order we’re going to see the environment go into updating so we’re doing the deployment of the code or Beanstalk rather is deploying all of the application servers and giving them the new version of code so while the application update is happening I want to talk about a bit about data storage and how we integrate or interact with the relational database service in elastic Beanstalk so when I did e be in it when I initially my application I chose RDS and that manifests itself again as a tile inside the configuration dashboard specifically the RDS section gives us information about our database and this says well you’re in point your connection string is here that’s your poor that’s your password and then the specifics about the RDS database and again getting back to the you know where you put credentials or configuration information we don’t want to put this information in our application source code we don’t even want to bundle it into a configuration file because these things could change so I want to talk a bit about the conventions that Bienstock uses to help you get access to this information so toggling over to the git repository here looking at the source code inside source I’ve got a PHP file called DB connect and it’s actually really straightforward we inject or we make rather this connection information available to your application as environment variables so this server underscore server global allows us to pool environment variables from the hosts so RDS DB name RDS username and RDS password or how we get this information out and then there’s one more challenge here there’s there’s a bit of an elephant in the room regarding the database at least I think so when I launch the application I said I started with a clean slate RTS database right it doesn’t have anything on it so what is if you’re building an app that writes to a database what does the database need to have before the application can write to it schema it’s got to have a schema so somewhere you have to run your create tables thing this is another example of something that I could do manually I could open up my sequel workbench connect to the database and run some scripts Bienstock provides a convention and I talked about Jane’s requirement was to be able to exert some control some customization over her environment so there’s another convention and elastic beanstalk and that convention is this thing called dotty be extensions so if you put a dot I be extensions directory along with your application at the top level you have the ability to drop these little configuration files inside that directory and these are yamo configuration files and Beanstalk recognizes that they’re special things and it does special actions based on them so I’ve written or I’ve included rather this database config file in my application and I’m telling for each server that the application is deployed to I want the MySQL command line tools installed locally and then I want a command executed and here I’m saying hey Beanstalk when when this thing gets deployed I want you to run deploy schema dot and the name is pretty indicative of what that script does but I’ve included it inside the ebee extensions directory so this gets executed when my application is deployed and you know create if not exists is important here so this is a nice convention for hey I deploy my app my schema happens automatically if you’re doing a rails application you might do rake DB migrate if you’ve done a schema change between deployments but this gives you a nice convenient declarative way to customize all the software on the box because it’s your ec2 instance to do things like

database setup but do it in a managed and version controlled way and this is something that we definitely want version control so as we make schema changes or we change the script it rides along with our application deployment so at this point I think we’ve got our I bet we have our application change deployed I’m going to open up here and I’m going to do a refresh of course I didn’t get any free thoughts let’s check the application version so one other bit of control that Bienstock gives us is the ability to manage which versions are deployed to the environment so in this case we have the version that I just updated or I just applied and we see that it is deployed I think I may have I think I committed from the wrong directory so I’ll check on that in a bit if we wanted to do a rollback let’s say we deployed something that didn’t work we can choose a previous version we can go actions rather deploy choose our environment and click deploy a few more things in the environment section so Beanstalk gives us the ability to pool logs we can click the snapshot logs button here and we’ll have access to the log files probably my favorite way to do this is as part of my command line workflow EB integrates with Beanstalk it’s aggregating the logs from the ec2 instances bundling them up and then here in just a few seconds we’ll see the output displayed on the screen so you can pipe this to grep and search for things and so we see that two instances pull the log files so those are all of the logs from Apache and PHP from my ec2 instances pull down into my local work flow for me to do monitoring and analysis on finally up from the monitoring perspective Beanstalk takes sort of all of the metrics that we collect for performance and ec2 and ELB it takes these metrics and it puts them in a convenient dashboard so I got it pretty early this morning and I ran some load tests or some load generation tools against this application and I Brandt about 72,000 requests against the app and we see over that we know one day period for 72,000 requests average latency was 36.1 seconds I’ve definitely over provisioned the ec2 instance here because I’m running at a very low CPU utilization here I would probably go back into the configuration page and change from an m1 medium to an m1 small because if I’m going to cost optimized I want to know that I’m using the CPU that I’m paying for so very easy to toggle between the ec2 instances run some low tests against the app and then use the metrics to decide what’s appropriate for your particular application so we really focused on the on the EB and sort of the PHP git workflow but Beanstalk does support Java Python Ruby dotnet and nodejs and it supports deploying those applications to three different environment types so we’ve got the single instance environment I use this for Devon tests for non production or non-critical systems this is just one ec2 instance there’s no load balancer and I have the ability if I decide to grow it into a load balanced instance but I maintain all the functionality around like pulling logs monitoring and and the robust configuration the environment that we launched and we demoed here was the load balance and auto scaled and we see that in the bottom you know in the app tier were scaled across availability zones or physical data centers in in this case the US West to region in Portland Bienstock supports the third environment type and this is background task or asynchronous task handling so the idea here is that you have in the upper left-hand corner you have producers some application is generating work and we’re integrating or pushing that work into sqs or the simple queue service it’s another Amazon service for message handling and the the queue delivers the application or rather integrates with elastic Beanstalk to send the messages to your applications gives you a very simple way to use PHP Ruby net nodejs Python to handle background tasks workflows I talked about git but Bienstock allows you to use the tools that you’re comfortable with or that you know to deploy and manage this could be a web browser in the console this could be eclipse we have a plug-in or a toolkit for both Eclipse and dotnet if those are your IDE s and then of course the the get workflow that we discussed but at the end of the day the kind of the objective here is really to get your application to get your application code deployed there’s an animation has a good animation we can even do it one more time for free I can write a PHP app in my sleep getting that stuff to line up I

was really proud of that so creating a Persians and then deploying those things back rolling back right we’ve got our application version history here at any time we can roll back the deployment and update it very easily we talked about how you can customize your servers with the ebee extensions directory and we went over the database schema example specifically in this example I’ve got a configuration file or I’m actually putting environment variables in and the environment variables here point to an s3 bucket where I’ve stored some secret information so again credentials secrets you don’t want to commit those with your application I’m storing them encrypted in s3 and then I’m setting an environment variable called API creds and then in my application code if it’s a Python application I can use OS and fire and get API creds and I’ll give me the link to s3 to download and the credentials in my app I can use system dot get properties in Java or app settings and dotnet or whatever application you deploy however you access environment variables that’s sort of the convention that we that we really encourage folks to take when they build Bienstock or building deploy Beanstalk applications I’ll be back in a bit to talk about cloud formation Chris is going to talk about the opsworks persona next thanks Evan so just kind of keeping everything in the family James brother Joe also does a lot of software development but Joe is um has a little bit different needs than James Joe um in contrast to Jane really likes to build software with some pretty broad architectural patterns so he kind of his apps come in a variety of shapes and sizes he likes to throw in things like MongoDB for database layers maybe his own H a proxy instead of using elastic load balancing he likes to customize his instances a little bit more and so he needs a high degree of thumb of freedom to be able to customize and really grow his app and whatever what variety he wants so um let’s talk to a little bit about one of the aspects before I jump into the demo of opsworks that I think it’s pretty interesting um who here has heard about chef as a use as a configuration management tool great so opsworks includes support for chef and and one of the things that it includes is the ability to run your chef recipes either on demand or in response to certain events that happen inside your system so you can run those recipes automatically and one of the nice things about being able to run recipes automatically of course is that you can automate things so we have a couple different life cycle events that you can attach your chef recipes to and they’ll get run whenever those events happen so the first thing is a set up event so when an instance Boop’s up a set up event gets fired and so runs set up recipes so what might you want to run with that set up recipe you might want to run like install apache install mod PHP these are the sorts of things we’re going to we’re going to show you inside this demonstration configure event gets run whenever any instance boots up inside your stack so a stack basically is all the resources you’re using as part of your application so why might you want use configure well let’s say you have a load balancer like eh a proxy you probably want to be able to bring app servers in and out of that load balancer as they they start up when they get healthy so that’s what configure can do for you the divorce deploy allows you to run recipes when you’re deploying your application you can run those recipes at any time like I said using xu recipes and then you can attach recipes to a shutdown event so if you wanted to clean up before you shut down like maybe you need to finish processing some things and your worker tears so here i have an app server i’m going to be booting up so my PHP app server it boots up it installs my PHP app server in this case i deploy my application to it and then joe likes to have not only the cloud watch monitoring metrics but he runs a ganglia server so as part of our demonstration we’re going to boot up by install ganglia on an ec2 instance as well so when that ganglia server starts up that configure event is used to make sure that the PHP app server starts sending metrics to ganglia and ganglia is ready to start receiving metrics from the PHP app server so that’s how we can really leverage these recipes so I’m not busily SS aging into my instances and doing things manually now when I deploy my application update again that deploy event gets sent to all the instances in my in my stack now for the ganglia the deploy is basically a no op but there may be times when I actually want to do something with that deploy event for example maybe the first time I deploy an application if I’m running say a Postgres layer and ops works I might want to create my database tables like like Ivan mentioned so you can use those deploy events if you need to and if you if you don’t need them then you can ignore them on any of your your layers if I start up another PHP app server what’s going to happen well my set up events are going to happen I’m going to be able to get get the PHP installed on on those that new instance as well and then a configure event fires off so that

instances well gets hooked up to to communicate metrics that I’ve configured to my ganglia server and then if I want to run a specific recipe on demand I can do that so I might want to change user permissions we’ll talk a little bit in the demo about how you can have user based SSH access to your instances and so if I wanted to add in a user to my to my instances then I can do that from from basically one command click and then of course I could if I stopped my app server I’ll run those stop the shutdown recipes and a configure event goes out to my other instances as well so hopefully I made a little bit of sense we’re going to will cover this in in the demonstration but just wanted to give you a little bit of an overview of the sorts of lifecycle events so you can use to help automate the customization of your recipes so for those of you who haven’t seen chef recipes just a quick primer on on what a chef recipe looks like basically there’s a couple different components to a chef recipe the first is the recipe itself which is expressed in a ruby type syntax here we have a recipe that basically represents the connection string which I’ll use to connect to my RDS database and then we have some attributes that are referenced in the recipe and so the the attributes are passed in is metadata that kind of comes in as a JSON type syntax to the recipe itself and chef takes care of decoding that for you so you don’t have to do any JSON parsing there and so you can see that it pulls out the database username password and and an host name to stick into this recipe and then a command gets executed at the end of it so it’s just a quick primer on what’s happening underneath the covers so we’re going to use a similar demonstration and sample app is what Evan demonstrated with or what Jayne demonstrated to us but this was also going to have ganglia so we’ll take you through that demonstration here command tab command tab tab tab tab tab – Datak you have i’m just learning how to use mac today guys so here we go sorry Windows user so we have opsworks console and so i’m going to do my demonstration through the console here and the first thing i’m going to do is i’m going to go ahead and add a stack so everything in ops works that you’re doing is all the resources you’re using as part of your application or your service is done in the context of a stack that’s really kind of think of that as the container around around all the objects you’re creating so let’s just go ahead and give it a name my sample app and we have a couple different options you can see here we have things like you know we can select the region scroll oh two fingers and drag sorry I’m pretty dumb so you can see we can select things like the region availabilities default availability zones which you can override and all sorts of goodness that one of the things that is probably most exciting is a hostname theme so we could be a little more exciting and select something like baked goods makes me hungry and and then let’s go ahead and open up this advanced and here’s where you can choose your your chef configuration sorry everyone so let’s go ahead and we’re going to use custom cookbooks because as we mentioned John it really does like to customize and so we have a couple different repository type options we can use git subversion archives on HTTP or s3 in this case we’re going to just go ahead and github is pretty convenient so I have all my cookbooks here already for me so why don’t I go ahead and and grab this this URL go back over here will paste it in if I had a SSH key from our repository I’d type it in there but this is a public repo and then we can see that I can add some custom chef JSON so you can use attributes that are inside your repository or you can put those attributes in here as well and seeing is how I don’t really have any use for right now for any of these other customization options I’m going to go ahead and add my stack so the the first thing I’m going to do is I’m going to add a layer and a layer think of a layer is a blueprint for your ec2 instances so every instance you create inside a layer basically inherits all the properties that you’ve defined inside the layers let’s go ahead and and we’ll create our first layer and you can see we have a cup different predefined layers so opsworks gives you some pre-built layer types you can choose I’m going to choose PHP and let’s go ahead and add that and let’s go ahead and also go ahead and add our

ganglia layer and you can see we also have this custom layer and so custom layer lets you basically install and run any software you want so with that’s MongoDB or or solar elasticsearch any software that’s out there chef has a pretty vibrant community of folks that are contributing to cookbooks and so a lot of times you can grab cookbooks out of the open source so for example 10gen the the folks that manage MongoDB have a very nice cookbook that works with ops works so you could run that under a custom layer I’m going to go ahead and create my ganglia layer and let’s edit our PHP app server layer to show you a little bit more about what’s happening so opsworks includes some built in recipes the configure the built in layers for you so it gives you out-of-the-box the functionality you’d expect for PHP so it installs Apache for example it takes care of that ganglia configuration and if you’re interested in taking a look at one of these are you can just click on them and all of our cookbooks are available on github as well so feel free to fork them give us pull requests we appreciate the feedback from the user community and then there’s a place for you to put your own custom recipes and you can see the life cycle ends that I mentioned so if we wanted to for example configure our PHP app server to connect with a database then I’d probably want to create some sort of recipe and in fact we have a recipe for that over here in our recipes area we have our app setup recipe and this basically takes care of the of getting the connection string and pushing it into my application so again I don’t have to keep my my credentials inside my source repo which is which is a good thing so I go ahead and just add my PHP app rusty and so now I’m basically extending a built-in layer so I can extend a built-in layer I can create a custom layer or I can just use the the layers as is once I get I’m able to actually figure out this this track pad we can also choose an elastic load balancer to use for this layer and since I’m going to be scaling out my PHP app server I’m going to go ahead and choose this elastic load balancer so it’ll route traffic to the the instances that I create in this layer we can see a couple other configuration options and I feel like an idiot here with this you’re trying to scroll down what’s that are you scrolling ah sorry the arrow keys will work – there we go we can also attach EBS volume so I could specify about a volume and mount point so if I wanted to attach a volume to say mm T data and specify raid level 1 10 gigabytes I can selecting a PI ops version volume if I want or just a standard one ops Torx will take care of doing that configuration I can assign elastic IP addresses if I wanted to each of these instances I can specify additional OS packages that might need to be installed so maybe my you know I didn’t have my sequel installed I can I can select that I can specify custom security groups and then one nice little thing here is auto healing so opsworks is constantly communicating with your your instances or rather your instances are communicating without Forks to see if there are events that it needs to take care of and run and if your instances get in trouble and they’re not communicating they might be offline or have a problem then off source can take care of restarting your instance for you so Auto healing that instance so that’s basically the configuration settings for for my PHP layer so now why don’t I go ahead and create some instances in these layers so I’ll go ahead and add a couple instances so I have a cookie instance and I can choose the instance type if I wanted I’ll add a ganglia instance and opsworks gives us some some flexibility on being able to configure instances that are on all the time or instances that are scaled for me as well so why don’t I go ahead and start these instances and we’ll we can look at that we have time and load based instances as well so if I wanted to create a time based scaling policy I could create an instance and then specify when that instance is supposed to run so this is pretty nice for predictable loads if you know that for example during the day you want to have a couple extra instances that come online but you want to shut them down in the evening and then of course you can create load based policies as well they look a lot like

what Evan was showing you an elastic beanstalk so you have a couple different options but every instance that you’re creating be in the that are associated with the layers basically get all the configuration details you specifying the layer so it runs the chef recipes at the time you specified if you asked for volumes to be attached it attaches that creates a volume for you attaches it in the amount point you specified so a lot of the kind of heavy lifting that you’d have to do otherwise gets done for you automatically and you have a lot of customization ability in that layer configuration so like Evan I’ve gone ahead and created a a pre-baked demonstration and so we’ll go ahead and talk a little bit about applications so I’m able to create one or more applications that get installed on my my layers and here I have a an application just named my app my application is on github as well and so I just pointed to this github repo and so you can see how a repository URL I’ll go ahead and edit this app and we can take a look at the what I’ve done I specify my document root my repository URL my branch and revision number so I can update that and redeploy if I if I made any updates on on my repository and then additional settings like domains and SSL settings and once I have my my application then I can go ahead and deploy it so when I set up my my deployment I have a couple different options so I can specify the instances that I want to deploy my application to so if I wanted to do something like a one box to Floyd I could I could select just one application to deploy it to it first and see how that deployment goes with that dead application or I can go ahead and deploy it to everything so I’ll go ahead and kick off that deployment and we can see that UPS Works is taking care of checking the are calling the recipes on my servers the PHP recipe checks the the my coat out of github so it does a poll get pull it knows to how to restart the PHP app server so that my application gets properly installed and if we take a look at previous deployments here are our deployments area we can kind of see all the deployments which user has run them what which which command was actually run so if I were to run a specific recipe you can see that and then of course inside the the deployments you can even see the logs for that so I could see the the Chevron log if I’m interested if there was any sort of problem or whatever I can see that directly from the console so I mentioned that you saw the users here in the employment so you might be curious as to what users opsworks supports so opsworks allows you to specify IM users and what sort of permission levels they have so i can basically say user mary who’s on my team is able to deploy apps but i don’t actually want her to change anything in this stack whereas our manage user will give that person manage privileges and manage users the only one who’s allowed to ssh in and and we trust manages are a bit so we’ll give him sudo access as well so i’m able to specify with a nice degree of granularity the sorts of control that the people on my team have with the resources inside my stack so i can use this for delegated access so you can give you know a specific user the ability to import other users and specify the the roles that they might have in that particular application and it gives you a lot of control over the types of things that people can do and then of course if they’re actually doing deployments you can see which user has done it and on the monitoring side similar to what evan showed you we also have aggregated cloud watch metrics so i can see for example my PHP app server this is all aggregated by by layer and then i can drill in and see specific servers themselves and drill in to see a bunch of instance based metrics so i can see things like the the CPU the memory the load of of those servers and these are all being collected by the agent that’s running on the instances themselves so that ends that that agent is what’s allowing you to kind of execute recipes on demand and collect metrics for you and let’s go ahead and take a look at at our application so we have our elastic load balancer tells me very nicely that running my instances in just one availability zone so i probably want to go ahead and start up something in another AC so i’ll have a little bit higher resiliency I hit that your thoughts I’ll get a very similar UI to what what Evan showed us but let’s take a look at my ganglia server as well because we did want to show how we could customize and run a different type of layer than just a standard web app so we have our ganglia monitoring server I’m going to go ahead and log on here and let’s take

a look at the metrics that ganglia is collecting for me so we can kind of see a bunch of graphs coming out here we can see that my PHP app one server has been added in hiware start up another PHP app server as I should since we are only running on one AZ then that app server would be added as well if we were to have the time to wait for that to come up which I’m not sure we do given the timing so in summary up force gives you a nice little capability of being able to have a little more customization through the layer configuration and I’ll go ahead and turn this back over to Evan to talk a bit about Scott mission awesome Thanks so Chris mentioned in the in the very beginning these three services Beanstalk opsworks and then cloud formation so cloud formation actually a show of hands who who has used cloud formation before very nice that’s a good a good number so cloud formation is a service that allows you to model your not just your application but also your environment in this environment could include your V PC so your networking it could be RDS databases ElastiCache clusters queues but you get to model your entire application and infrastructure as a JSON document so a template file and then of course you you know version control the template file you check it in to get or subversion or perforce and then you give that template file to cloud formation and it executes the api’s on your behalf so it does orchestration it knows the proper order to create things and maybe just just as all Yubel as it knows the proper order to delete things so it allows you to manage from start to finish the provisioning of an entire application an application stack and the other big thing that I really like about this is that it’s repeatable so the same template file can be shared with everyone on my development team so we all have identical environments if I decide to take this wicked your thoughts app it’s going to be big and I want to move it to European audience and I want to deploy in the eus region in Dublin I can take my CloudFormation template file give it to the endpoint in Dublin and I get the exact same infrastructure stack it’s identical between deployments because what everyone knows this if you do these things by hand then they’re different from every single time or when a person who builds the infrastructure leaves and takes a different job when you’ve got cloud formation that is sort of that’s your documentation in a way of exactly how everything was was built so I said cloud formation can create a lot of different AWS resources I mentioned B PCs and ec2 instances and RDS databases it can also define and provision an ops Works application or an elastic Beanstalk application for you so in this case here’s my my beanstalk environment for the your thoughts’ app and next month I’ve got a in my next sprint I’ve got some items to add DynamoDB so I want this applications to start using dynamo in addition to RDS and I also want the application to provision an s3 bucket to store some images and I’d like it to use identity and access management so I could create all of these things by hand in the console but when I want to do that again or when I want every person on my team to do that it’s not going to be predictable so rather than create these things by hand I’m going to wrap them up in a template file one more animation left there it is so we take our entire application and our infrastructure and we model this as a template file and then where do we store it version control so we version control these things so when I change the specifications for my dynamo table or I change security groups I’m actually modifying a template file I’m version controlling that so I can look back at any point in time and say oh that’s when we accidentally opened up port 22 or that’s when we change the size of the RDS database and maybe even better I can point the fingers at the people who did that and I can use confirmation to it back so create your stack modify a template update your stack confirmation will execute the api’s and then if it’s a dev or test environment delete your stack and it will tear everything down for you so we’re now we’re getting into the conclusion slides so some of the things that we discussed is to what do they say you tell them what you’re going to tell them then you tell them and then you tell them what you told them so this is to tell you what we told you part sort of how to choose or how to gauge which is correct maybe for your application Beanstalk opsworks or CloudFormation how to get an application running with both Beanstalk and opsworks and then sort of where CloudFormation fits in for provisioning and managing resources and again those things include Beanstalk applications or beanstalk environments and then we’ve got two to quick calls to action here so we are going to start on office hours hangout this is a five-part series that we’re launching on April 10th and in this five-part series of the title is

developed deploy and manage force scale with elastic beanstalk and cloud formation so we’ve got this really beefy it’s a tomcat or a java application that uses spring that’s built inside of elastic beanstalk and we’re going to talk about sort of from step zero all the way up to running and scaling this thing globally how you do it so that is how do you write the cloud formation templates what are the best practices for how you use multiple templates how do you do configuration management how do you use cloud formation to operate an environment so this is getting out of the console a little bit and using that version controlled continuously integrated approach with cloud formation so that’s the link and then we’re going to integrate opsworks into these office hours sessions as well and so the office hours idea right is that we get on hangouts and we’re there for an hour if we have a topic we usually have a blog post in a github repo and you know you have the material you have the sample code and so we’ll be publishing the the ops work sessions in the application management blog as well so with that said I want to again thanks thank everyone on behalf of myself on behalf of Chris for coming out we will be we’re going straight to the booth right now to do booth duty so we there to answer all questions or take feedback on these services we really love to hear that and so look forward to interacting with you at the booth this afternoon thanks again folks okay