Deploy - AWS Elastic Beanstalk
Objectives
After this lesson, developers will be able to:
Describe AWS Elastic Beanstalk
Build a web app and deploy to EB
Preparation
Before this lesson, developers should already be able to:
Build a functioning full-stack application
Explain what a virtual server is
AWS - Amazon EB Intro (20 mins)
Amazon Elastic Beanstalk is an easy to use deployment system that will automatically allocate the necessary software needed such as EC2 instances and S3 buckets. EB comes coupled with a command-line tool that allows for quick code deployment.
While a little bit more in-depth than heroku, Elastic Beanstalk is helpful in that you can scale your app as you develop it. Meaning if you need more resources such as RAM you can change that on the fly.
You can access any apps you've deployed through the Elastic Beanstalk management console:
The EB portal can be used to manage our already created apps or to create new ones.
Installing the eb-cli
Create a node app to deploy
Add a Start command to our scripts object in package.json:
index.js
index.html
Initialize your app for Elastic Beanstalk
Create Environment on AWS
Now that our application is created we should see it show up in our EB console on aws.amazon.com.
Go ahead and click the Create one now link
Now you should be seeing the beginning of our Environment Creation page. Click the Create web server button
For our Predefined configuration select Node.js from the dropdown and select Single Instance for the Environment type
The configuration will set up our server with Node.js and it's dependencies already installed. The two environment types are:
Load balancing, auto scaling: This setting is for if you know that your app will grow and you need to have some versatility to the hardware of your environment.
Single instance: This is primarily for if you are deploying a smaller app that won't have many requests or is for development, much more minimal.
From here continue to click the Next button for each subsequent page until you are at the Review Information section. Once there, click the Launch button at the bottom.
At this point you should see a screen like this as your app platform is partitioned and setup by AWS. This portion will take several minutes so go grab some coffee!
Eventually you'll get the green checkmark which means your environment has been created!
Make note of your Environment Name located at the top: All Applications > application_name > environment name. Copy and paste that environment name and paste it into your config.yml for the Default environment:
Now you're ready to deploy! Go ahead and run this command in your app directory:
Last updated