class: center, middle # Elastic Beanstalk __CS291A__ Dr. Bryce Boe October 26, 2017 --- # Deploying to AWS Now that you all have a start to your rails application on Github, it is time to learn how to deploy to AWS (Amazon Web Service). Amazon provides a tool called Elastic Beanstalk that we will use to create various deployments. https://aws.amazon.com/elasticbeanstalk/ -- Amazon will provide AWS credits if you sign up for AWS Educate using this link: https://www.awseducate.com/Registration?apptype=student&courseview=true * Type in "University of California Santa Barbara" as the institution * Select "Scalabe Internet Services - CS291A" as the course --- # Working with AWS Guideliens Additional AWS resources are being donated by AppFolio. Please: * __NEVER__ copy your AWS credentials into your code nor make them publicly available. -- * Only deploy when you are ready to test something or demo. -- * Terminate your deployment immediately when testing or the demo is done. -- * For demoing and deployment testing please only use a single `t2.micro` instance for the application server, and a `db.t2.micro` instance for the database, without a load balancer: ``` eb create -db.i db.t2.micro -i t2.micro --single ... ``` --- # Working with AWS Guidelines * For vertical scaling tests, always start with the smallest instance type and work your way up within the same deployment in order to minimize the time that larger instances are deployed for. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.ec2.html -- * For horizontal scaling tests, try to consistently use the smallest instance type that works for your application. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.as.html -- * Reset your database, and flush all caches between tests for consistency. -- * Do not use any of the `t2` instances (e.g., `t2.micro`) for neither the app server nor the database when performing scalability tests they have a CPU quota system that will affect results. -- ## When in doubt, please ask. --- # AWS Instances and Data Because instances should only be up for a limited amount of time it's important to: * Fetch any important data on the instances as soon as available (e.g., test results) * Quickly load large amounts of testing data (test this process on smaller instances) --- # Deploying to Elastic Beanstalk Instructions for configuring your app, preparing, and deploying are found at: https://github.com/scalableinternetservices/demo_rails514_beanstalk ## Oregon Region Ensure that you are utilizing the __oregon__ (us-west-2) region. --- # By The end of Lab Demonstrate that you can successfully deploy your application to AWS by demoing on AWS. __Note__: All teams will be expected to demo on AWS for all following labs. Launching a new deployment will take >10 minutes so kick it off prior to lab.