Wednesday, October 05, 2016

RailsConf 2015 - Deploy and Manage Ruby on Rails Apps on AWS by Alex Wood, Trevor Rowe, and Loren Segal

yeah
so alright everyone thanks for coming out to learn how to deploy and manage
ruby on rails applications on amazon web services so a quick introduction to who
we are
so all three of us work on the AWS SDKs and tools team I'm Alex would you can
find me on twitter and github and in the back handing out codes we have Trevor
row and lawrence ago
you can also find on twitter and github and if you have any questions during the
lab feel free to raise your hand and Trevor and Lauren will come down and
help you out and during the parts were just working on exercises you can ask
questions at me up here as well so what are we doing today we have a ruby on
rails sample application that's linked inside the instruction document you
don't need to bring it down or cloning or anything but it's there so you can
look around see how we did integrations play around the further after lab is
done we are going to deploy that to amazon web services using AWS opsworks
after that we're going to use Amazon simple email service to send action
mailer messages using the new AWS sdk rails gem and we may run over time for
the last part but all the instructions are there
we're going to show you how to catch the rails asset pipeline using Amazon
CloudFront so here's a slide that was up while everyone was coming in so just a
quick show of hands again if you do not have an AWS account yet could you raise
your hand
cool so for this lab you will need an AWS account and with the credit handouts
that were giving out you can just create an account straight from there can you
raise your hand if you don't have a WS credits yet critical
so Trevor Lauren will be buying a second with a credit for you
so we'll take a couple minutes here just to make sure everything is set up so log
into your AWS account or make it if you don't have one yet
apply your credits which you shouldn't need for the lab but fifty bucks that
encourage everyone to take it an experiment afterwards try things out and
there's also a tiny URL link to the instructions page for the lab so if
anyone can't get to that page let me know as well and will take about one
more minute for this then we have these positives feel free to shoot a question
to me if you have one at a time
yeah
yes just the double check is there anyone who does not have their AWS
credits in their hand and applied yet
raise your hand so Trevor Lauren can find you
yeah i mean if you if you have an account you can still apply the credits
to it
the lab is we're using the smallest instance types and we're cleaning
everything up afterwards so and if you're in the AWS free to hear that
should cover some of the costs as well but definitely take a credit anyway and
keep playing around
we'll talk a little bit about what you can do at the end of lab as well and
we'll be hanging around afterwards if anyone wants to ask more questions or
try more stuff out
cool alright so let's talk about what we're building so we're building a
two-layer web application with AWS opsworks so we're going to start by
creating an office works stack which you can think of is a container for all of
the other resources that are application deployment is going to have we're going
to have two layers as mentioned before a rails app server layer which will
contain any instances that are running ruby on rails and separate from that and
the connection configured by opsworks a my sequel layer that is going to be
running a single ec2 instance with my sequel on it
we're also going to be from the a player sending out emails to user accounts with
amazon SES the eight of us sdk rails gem and we're going to catch the rails asset
pipeline using Amazon Cloud front so why opsworks this is a question I've heard a
few times while we've been talking about the lab earlier in the conference I
wanted to kind of strike a midpoint on the convenience and control scale so
opsworks gives you a lot of fine-grained control over how your instances are
configured how you scale them and where they live
which we have other options such as now AWS code deploy cloud formation or
manually using instances that give you more fine-grained control
or chasing our choices like Amazon ec2 container service and elastic Beanstalk
which give you more convenience so we're definitely happy to talk about any of
the other options afterwards but this is a nice middle ground I think for the lab
that we're doing today so i think we already talked a lot about these but
just a review of some of the key concepts are going to talk about so AWS
opsworks uses chef to help manage and configure your AWS instances so we
talked about the concepts of a stack in layer is also a concept of an app which
contains all the configuration needed to deploy your application to your
instances are also using the new AWS sdk route rails ruby gem
so out of curiosity releases a few weeks ago can you raise your hand if you've
tried that jam out before awesome so if you using that and that builds on top of
the AWS sdk for Ruby v2 that we release last year we're also going to be
covering a little bit about AWS identity and access management talking about how
we can manage our credentials safely and best follow the principle of least
privilege including IM roles for amazon ec2 which the atavistic k-rails gem can
use and we're also going to review Amazon SES and cloud front so we have a
rails application
what do we do so that we can actually deploy it to 80's opsworks right here is
the diff can see it might be
yeah so I'll just review what it is it's a change to the gem file where we say in
production we use the unicorn gem in the my sequel to database adapter gem and we
create a file called before symlink in a deploy folder in our rails application
which essentially pre compiles are static assets during the deployment
phase so before symlink is a chef
hook who here is familiar with Chef looks cool
so this is already provided for you in the repo we're deploying so we don't
have to make these changes this is just a review of the changes you would have
to make to take a rails application you have and get it so we'll deploy and run
on AWS Hobbs works so now we're going to get into the first exercise we're going
to take our sample application and deployed to AWS with opsworks so to
start going to create a stack we're going to create the application and
database layers and then we're going to create and deploy an application so the
first exercise and the instruction sheet does have a link so you can jump around
the different exercises is to create an opsworks stack so I'll leave you guys a
few minutes to do that and if you have any questions feel free to let me know
anytime
sure
ok
turn
so just tinyurl.com / railsconf 2015 dash AWS and if you're watching this on
video I'm going to keep that link up after the conference and if the link is
not up for any reason feel free to get ahold of us so i can remedy remediate
that does everyone have that now raise your hand if you don't have the
instruction sheet open cool because a minute
are we good to go in the instruction page raise your hand if you don't have
it
cool
one thing I want to call out while you're making your stacks as well is to
check your VPC option so if you do not have a default VPC so if i look at these
v pcs i have a default VPC and one that I created earlier I would choose the
default BBC because that'll work right out of the box and if you do not have a
default BBC option available please raise your hand so Trevor Lauren could
help you out if you don't have a default VPC what region are you and me
yeah
yeah
so the question was what is a VPC and so VPC stands for virtual private cloud so
your instances inside a VPC you can have control over what kind of inbound and
outbound traffic outbound traffic is allowed for example instead of different
subnets so it's sort of a way to handle networking for your instances so for
example as you could work to expand on this app you might say that your app and
database instances should not be accessible from the public internet that
they can only be accessed through a load balancer instance or ssh traffic through
a bastion server and if you have a VPC it makes it easy to set that up so for
the purposes of this lab or just deploying in it and they're going to be
fairly permissive the instances will be publicly accessible but we'll have a
little bit of a discussion at the end is how you could further production is the
application as you iterate on it
so in additionally while you're creating the stack you'll notice the instruction
sheet it has a instruction first to make an ssh key strictly speaking you don't
have to do this but it's definitely recommended in case something goes wrong
we'll be able to ssh under the instances and see the logs and if you have an
existing ssh key you can import it or just use that when you're creating the
stack
yeah
so frequently asked question has been what should i name my key pair you can
name it anything you like I names Mine rails comp so right
the trick is you want to make sure that you know the key are using is on your
machine and then when you add that to the stack it means we'll be able to ssh
to your instances
so for the purposes of lab we're using a database layer that opsworks provides
for you in the appendix section of the instructions I've shown how you can use
Amazon RDS for either postgres microsoft sequel server oracle or even my sequel
instances with RDS and failover so there are further instructions about how you
could do that and you can follow along with that after lab and then in other
cases so what opsworks will do is it will wire up your connection to your
database so if you wanted to use a different type of database instance you
could configure that in your rails application and rails were just connect
to that
this is a show of hands who has they're stacked created
ok so we'll leave a few more minutes for that
no you don't have to create the whole thing just having created the sack and
then the next exercise is going to be to create the layers
yeah so sorry just to make that raise your hand if you have not made the if
you have not gone through the ad stack form yet if you haven't made the layers
yet
that's ok that's the next exercise and then raise your hand if you need help
getting that setup so we're working a dealer you have a question can help with
yeah
so the question was if creating a key is necessary
again you don't need to create an ssh key but if something goes wrong later
with your application and you don't have an ssh key we don't have a way to look
at your logs so i would highly recommend it
and then if you have created your stack and you'd like to move on to the next
exercises feel free i think this first exercise probably takes the longest with
all the initial setup we have going on
so for the add stock form most of the fields are going to use the defaults but
if you look in the exercise instruction list out a few that you'll want to
change one that is important is you want to create new IM instances or new IM
roles because we're going to edit them and if you don't create a new role your
change could be if you have multiple stacks you'll be changing the
permissions on all of them at once so it's a best practice to create a new
role
anytime you're creating a new stack so the question was if we need to create an
elastic load balancer so we're not creating an elastic load balancer during
this lab now go back to the so in this lab simply for time purposes we're going
to directly connect to your application server it is a best practice to have a
load balancer but for the sake of time we're simplifying the architecture and
we'll talk a bit about it at the end about how you would design things as you
iterate on this design so the next step is exercise one beyond the instruction
sheet which is we're going to create the ops works layers and launch an instance
in each of them and again we're we're using non default options that should be
in your instruction sheet and i also added for many of these a screenshot
that you can compare against shirt so the question was what would be the
difference of choosing an instant store vs and EBS back store for the sake of
this lab there is no difference the difference you would find if for example
you're running your database on instant storage if that instance goes down you
lose your database and everything on it unless you have snapshots and backup so
you're creating if it's an EBS back instance if the instance were to go down
you would still have the EBS instance with your hard drive on it that you
could attach to a new instance you create to replace your failed instance
that is your question so you could choose the so the question is when would
you choose instance store and the recommended default in objects is to
choose an EBS back instance but for example if you feel that the storage on
your instances enough safe your application server and you don't care
about anything on it because it's stateless you could choose an instant
store and as the syrup if the server goes down it doesn't matter
another thing to remember is we're creating my sequel opsworks layers were
not creating RDS layers this is simply a matter of the fact that using RDS
instance takes a little bit more time and for the sacred lab we're going with
the quicker time option but we do have instructions in the instruction sheet or
a link to a blog post that will show you how you could switch this over to use
RDS now it also recommend that you keep an eye on the instance size that you
select as you can see here the default is ac3 large which is going to be a
little bit more expensive than 80 241 micro but the smallest instance types
are more than enough to run our sample application and then once you get to
this point where you have both layers created and your instances are spinning
up then you're done with this exercise the instances will take a few minutes to
set up and you can work on the next steps while they do so the question was
about the fact the instructions say to create the instances in a VPC so this is
based on your stack settings whatever VPC you assigned to your stack is the
VPC the instances will be launched in or if you are in the u.s. East one without
a VPC they'll just be launched in dec two classic so if you take a look at the
instance creation screen you'll notice you can choose the subnet that it goes
into the default subnet is going to be fine for all of these and this is just
where in the VPC the instances go that into your question yeah so the question
was that i mentioned this was running on chef and so what is going on during the
running setup phase so I'm gonna go to a different screen on here for a moment
that I think will help demonstrate that
so when you look at your lair configuration remember that layers are
telling you how everything is configured so if you look at the recipes page
forgiven layer it shows you during setup configure deployments and so on what
chef recipes are running and if you click through it will actually take you
to the opsworks github repo and you can see the source of all the chef's that
you're running and you could also add your own recipes during these processes
you can add or remove anything that you want to customize how your lair works
maybe take a look here that the my sequel layers going to have different
recipes running then the rails app server layer was so one thing the layers
do is define what type of recipes are going to be run on any instances that
are made in that layer so that is configured at the 20 the stacker 2 layer
level and you do have a dropdown selection of what type of instance or
what type of linux distribution you're running on the sake of lab using the
most recent amazon linux will work fine
cool alright so we're gonna move on to the next exercise here and there will be
a bit of a positive the end while we wait for some of the instances to catch
up and create so next we're moving on to exercise 1 C which is creating and
deploying the opsworks application so one quick note when you get to the app
creation about the secret key base environment variable normally you're
going to want to run rate secret on your rails repo but for the sake of what will
actually work for deployment any string of letters and numbers that isn't made
entirely of numbers will work so i can write your favorite sentence without
spaces that wouldn't be a production safe thing to do before the lab if you
can't run rate secret and copy that value this will do but you would also
want to make this a protected values and so what's your secret he is set you
don't want people to be able to see what it is
the other thing to note is where explicitly not enabling ssl so this is
purely a time-saving thing and also since I don't expect everyone to bring
their own certificates obviously in a production setting you absolutely do
want to have SL setup for your instances since otherwise you're sending things
like user registration info on passwords plaintext over the wire but for the sake
of a sample application it will work just fine without us to sell enabled
and then once you have your application created you're waiting for this to be
the result of the instances screen we're both instances are online and running
and once you have that you would go on to deploy
so well everyone's working on that the two most common mistakes we had when we
were testing out these instructions were not setting your secret key base which
we don't set that you'll get a white screen when you try to load your
application to be completely blank because rails will fail to start running
and failing to migrate your database since this is in this little employment
we do have database changes we need to run so when you go to the deploy screen
you'll turn my great database TS and then Ops will run rape DB migrate
against your database instance if you don't do that you'll get the generic
rails error screen you try to load your app
alright so once you have your deployment successfully completed to find your page
you would click through your app servers hostname and you can click through
either the public dns or the public IP to get to the app and this is what you
should see and once you get to this point you're done with exercise 1 and if
you have a few minutes maybe play around register an account make a few tasks
when you make an account it will be helpful for future tasks if you use an
email you actually own this doesn't do e-mail verification but you won't be
able to send email to an account that you don't possess with a test account
and messy asst
it's also worth noting that at this step if you try to subscribe to a task update
and send mail it's not going to work yet because we haven't configured it
yeah and for the sake of I I'm actually not sure how SES test accounts handle
aliases if you have to explicitly verify each one about actually interested to
see how that works out if you try that
yeah for the sake of a demo of registering one account on an email
address you own will work to demonstrate everything we need to do however so you
don't have to get too complicated with your emails if you don't want to
so just for a quick check can you raise your hand if you've gotten to the
running application page could you raise your hand if you haven't gotten that far
but you've got your deployment started you raise your hand if you're still
waiting for instances the boot
ok that's good that's not very many people
so what will probably do in those cases is just get your deployment started as
soon as your instances boot and we're going to take a few minutes explaining
what we're going to do on the SES exercise and that can happen while
you're waiting for instances to get going
so we'll leave another minute for that
yeah
so the question was if there's a postgres layer so AWS opsworks only
provides a my sequel database layer as far as they're easy to manage instances
if you use an Amazon RDS layer you can use any of the database offerings that
RDS has so you can use my sequel postgres microsoft sequel server oracle
or someday in the future the Aurora database for RDS that Amazon is building
so the question was if you can create your own custom layers i'm actually not
sure on that front i think that maybe more designed for can fit you can
customize the configuration of layers within your stack but that's actually
good question i'm going to get the definitive answer on that and i will
post that up after the talk so the question was if you have a my sequel
instance running on ec2 how do you get it so that the app can use it so the way
that opsworks sets things up for you so that the database just works when you
deploy is it uses the configuration values of the instance in the database
layer and the database layer itself to create your database . yml file so if
you don't have your my sequel instance inside the my sequel layer then it's not
going to work but i believe i can check this for you you might be able to
actually take that instance and register it but maybe not for that so like bring
your own database . yml file for the sake of lab I wouldn't recommend it
because you I think you have to change some of the underlying chef recipes that
are going to try to write it
given enough time you could do that but for the sake of this lab I would make
sure you creating and opsworks owned my sequel instance
alright so we've taken our show hands who has not started deploying the app
yet
ok so we're going to start on the explanation of the next exercise and
there should be time to catch up there so the next exercise is sending emails
using Amazon SES and the new AWS sdk rails gem so the sub exercises here are
doing the configuration necessary to run the AWS sdk rails gem verifying an email
so that you can send to and from mail for that with ses and then we're going
to talk about how we configure in opsworks I am instance roll profile so
the sdk has permissions to use Amazon SES to deliver your mail so how do we
change our application to be able to use the atavistic a rails gem again
apologies for the size of the screen shot here but it's a one-line change so
i can just explain it to you if you require the AWS sdk des rails gem prefer
that you have the dependency locked version 10
that's all you have to do all of the that's why have to encode the
configuration creating the delivery handler that will all be done for you by
the sdk as you can see when you get into the exercise all you need to provide is
environment variable for the AWS region you want the estoque to run in so if you
move to exercise to a in your instruction sheet we're going to pick up
from there so no you don't have to
so this is actually a good question let me repeat that the question was if
you're using the AWS dash sdk gem in your gemfile do you have to remove it so
there's two possible cases here one is you're using the AWS dash sdk gem
version 2 in which case that is also what the AWS sdk Disraeli's gem uses
and there's nothing you have to do they'll just work if you're using AWS
sdk version 1 it will still work the v2 and v1 SDKs can coexist in the same
project and the reason this works is the AWS sdk rails gem does its dependency on
the highest level subject of a dios esta que the ados sdk resources gem so even
if you depend on AWS sdk version one you can use both in the same project that
answer your question
excuse me so one question I would ask that can you raise your hand if you did
not create your stack in the Oregon region cool so pay attention when you're
creating the AWS region environment variable it should work in any region
although it'll be sending emails from a different region than your app is
running in but it's a good practice to have the 80s region be the region your
stack is running in so yeah so if you created it in Northern Virginia which is
probably the second most popular option then the region you're looking for is us
dashi stash one if you created in something other than that then let us
know and then you don't need to do a deployment for this step because we're
not using the sdk yet so once you've changed your application you're done
with this exercise so a quick note if you're arriving here from another talk
welcome make sure you raise your hand so Trevor and Lauren can find you and give
you credits i have known people who can catch up pretty quickly on what we're
doing but if you're just behind on the explanations go ahead and work through
the instruction sheet which one of your seat tablemates should be able to give
you and then this will obviously be up on video so you can catch up on what
we've been talking about up until now so could you guys raise your hand if you
have not added the 80s region variable to your application yet
so that is a availability zone so the question was does it matter if it's
uswest 2a or 2b those are availability zones what you want to set is the region
so you do not want the ARB on the end that won't work
so for organ again that would be us dash west ash to so the next exercise to be
is to set up your email for testing with amazon SES so unless you have an
existing production account you essentially have to validate every email
address that you send from or send to we're going to set an environment
variable for what address you're sending your email from which should be one that
you validate and owned and for the email you send to that's going to be any
account that you register inside your sample application so that's the next
exercise and we'll have a few minutes for that so when so the question was
what you have to do for this so you go first to the Amazon SES console under
the verified email addresses linked there's a direct link to that inside the
inside the instruction seat although fair warning verified addresses are per
region so you want to make sure you're using the same region you set as your
AWS region variable and once you request to verify email address you have to go
to that email account and click the link once you've done that it should show is
verified in the console no that's it
yes so then the next step you're going to do is the email handler inside our
source code expects you to set the environment variable from email so that
the action mailer handler knows what email you're sending mail from so you
just configured out to be a verified email address that you want
mhm right so I'm gonna show how we do that here so if you go to your
application and you click Edit you would add a environment variable from email
and have that be an email you verified and
I'm sorry you don't need to stop the app but before will take effect you will
have to redeploy it so you can't deploy the app because it's running that is
strange because that's working for me so I want to take a second to come look at
that for a application are you trying to edit the instance or the application so
just follow along if we go to the app screen and you're editing the
application that requires you to stop it
so my my best guess before i come take a look at it as you've probably tried to
stop your instance which you don't have to do
so just to recap the I think my instructions were sorry about that
unclear on this part when you are editing your application you are not
editing your application server instance you're editing the Ox opsworks
application itself so if it's telling you that you need to stop an instance
you're on the instances editing screen follow the navigation bar to the apps
editing screen
and then the exercises done as soon as you click this link and have started a
deployment
so I see a couple questions so sandbox access means you have to verify every
single email address that you sent from or two it's that it's it just means you
do not have production access so if you have production access to amazon s3 s4
certain responsibilities about things like how often you get reported for spam
how often your emails balance and you have to apply for that with the test
account you just verify everything you own every email you send from or two so
just go to the drop-down and move to the Northern Virginia region so you want to
verify your email address in the same region that you created your app in so
if you look at the SES console up on the screen there is a drop down where you
can pick which region you want to run from and this region should match the
AWS region that you set in your application as you can see here I have
the same sandbox access on this account so when you change did you subscribe to
the task first that means you haven't configured email yet so when it tried to
send email the application blew up so that should stop happening as soon as we
finish this exercise is it so by default you have test access or sandbox access
to Amazon SES so the API will check the emails that you're sending from and they
are sending to and requires that they are all verified by you
so in this way with the sandbox account you can't send email to random other
email addresses so in amazon SES you can know it so within amazon scsu would ask
your account to be authorized to send email and production so there's a form
within SES where you can do that and it comes to take it with support
yeah yeah use I believe you still have to verify your from address but then
you'll be able to send to anyone as long as you follow the rules associated with
that right so in this application if you register an email address that you don't
own it just won't work to send email to it as long as you have also verified the
to address if you had production access then you can send to anyone as long as
you're from emails one that you own that makes sense
that's right
yeah
so who has gotten to the point where they've deployed with their AWS region
and from email set and has validated an email address so just a bit more than
half of you so we'll have a few more minutes for that you had a question in
the back
so have you gotten to the identity and access management step yet so you're not
going to get emails after finishing this exercise because by default the instance
profile they're going to talk about next has permissions to send to absolutely
nobody or two it cannot make any API calls
it's kind of a principle of least privilege for your instances so we're
going to explicitly authorized our application server instances to make
calls the Amazon SES through the sdk so once we finish the entire exercise too
that's when email sending will work so if you're running into a problem that
you can't identify so the first thing if you run into a problem is raise your
hand so you know one of us for Trevor warring can come see if it's a known
issue otherwise you would use the ssh key you created and you can ssh onto the
instance and look at the rails application logs emails will not work
yet after exercise to see they will work
so raise your hand if you have not been able to deploy the new environment
variables yet
cool so we're gonna move on to the next exercise so what we're going to look at
now is giving the opsworks I am instance role permissions to use Amazon SES and
this is the last thing that you might be getting errors on if you've tried to
send email to this point so for a bit of background the reason that this is
necessary
remember in the beginning when we created a stack we created I am instance
roles that were attached to each instance in your stack by in the AWS sdk
can find and use that instance role as credentials but by default you have
permissions to make absolutely no api calls the only permissions it has a
trust relationship with opsworks for the opsworks agent to run the operations
that needs to run so any API calls you want to enable your instance to run you
have to explicitly allow and that's what we're doing with this exercise
yes
and then remember on this screen i do have a screenshot for this but you're
looking for the opsworks CC to roll not the opsworks service role because this
is the role that the sdk is using to get its credentials
and then as soon as you've attached the Amazon SES full access policy you're
sending of email should work
you don't have to do a redeploy it takes effect immediately
so once you've subscribed to task updates and change the task state who so
i may have done something wrong myself so I look at the CC to roll have applied
the full access
Oh
I used the wrong email here that is not an existing amazon.com email address
so let's try that again
dangers of live demos so now that is working and if I check my email
we have a task update email sent so when you go to Amazon scsu verified yourself
as a center and that should be the same email the user account you sent to so my
attempt broke because i accidentally autopilot enrolled at amazon.com instead
of at gmail com which is not a verified address so it did not work
so really quickly we have about 20 minutes left so i'm going to take a
minute to finish some of my explanations and then we'll be hanging around around
in this room and then out in the hall if we want to keep going
so I wanted to talk really quick about what we did in the application in order
to configure rails to use the sdk as a action mailer delivery method when you
require the AWS sdk rails gem it creates a symbol AWS underscore sdk delivery
method and that is configured to use the AWS SDKs amazon SES client specifically
the send wrong email method as the delivery method for action mailer and
that will work and that's the only change you have to make you do that in
your configuration for any environment that you want this to work in that and
making sure your email addresses are verified and that you have permissions
on your role to make this call so there is another exercise which we don't have
time for in this lab but it doesn't take long to do so i'd recommend checking it
out and that's configuring ruby-on-rails asset pipeline to use Amazon Cloud front
as a CDN the code change in there is really simple we look for the asset host
as the environment variable CDN domain this is working in your deployment
because right now you didn't set it so it's no so just use your application so
if i look at if you look at your source HTML you'll see it's pulling from the
host that you're running on so
if you look at the bonus exercise and work on that you'll end up creating a
cloud front distribution which does take about 15 to 20 minutes which is the
reason we're not doing it now and then you configure the CDN domain to be the
domain name of the distribution you created and then once that's set up
you'll see that the HTML is pulling your static assets from the CD CD and domain
you've created and we have wrote a blog post about this if you're interested
so we mentioned that we were making a few simplifications for the sake of a
lab it is worth noting that you can take this a lot further
so what I kind of diagram out here is a bit more of a production eyes dops works
creation so you could have this cloud front CDN you could use a product like
Amazon route 53 to set up dns so you can put your cloud front distribution behind
the CDN domain you can . other domains two parts of your application you can
use elastic load balancing to load balanced across many app server
instances instead of a single instance you can set up time based auto scaling
of your app server instances so if you know that every night at midnight you
get a ton of traffic you can set that up to scale up new instances in
anticipation of that traffic or load based scaling so if you get hit really
hard new instances are created as needed to get a question back there
I'm sorry so the question was what is the CDN and that's a content
distribution network so when you use Amazon Cloud front you can set up your
application as the origin server so Amazon Cloud front had the last time I
checked and i say that because last time I said it I was wrong and they'd added
more edge location since last time I checked they had 53 edge locations
around the world so you could be running your application server in Oregon
and you can have a person from Australia visit your website and the static assets
you have such as large images could be cashed in an edge location in Australia
significantly reducing the load on your servers and the page load time the other
thing you could set up is our ds's your database and you could have for example
automatic failover to a standby instance in another availability zone so in the
off chance that entire availability zone goes down your app can fail over and
keep running
so this is what you can build and what I hope you get out of this is that what we
did build gives you the knowledge you need to keep iterating on it and build
production-ready systems using amazon web services and ruby on rails so
definitely keep in touch with us we'd love to hear your questions we have a
ruby developer blog and we would love to hear your ideas for what you would want
us to cover and what you would want us to talk about and thank you very much

No comments:

Post a Comment