AWS: Cloud Servers

Overview

“The Cloud” is at the core of most internet applications, from distributed data, to servers, to games and web/data hosting services How does it work? How can we leverage it?

Class Outline

Learning Objectives

Students will be able to

Describe and Define

Execute

Use “Elastic Beanstalk” to Deploy a NodeJS server to an EC2 instance at AWS

This requires 2 parts:

  1. An “Environment” (container) for our application to run in
  2. The application code itself to be deployed “into” the environment

Notes

AWS is not free!

We highly recommend that you shut off all services at AWS following the completion of this module

Elastic Beanstalk

Elastic Beanstalk (EB) will automatically wire up essential AWS services to create and deploy a running application.

For Node.js applications, this is generally just going to be an EC2 server instance along with an S3 bucket that stores our files

There are 2 ways to create a new application with EB, detailed below. Either way, all of your environments and applications will be available in the AWS Developer Console (GUI) for you to manage

Creating an application with the Elastic Beanstalk GUI

This will create your application and environment in one step, giving you a full GUI from where you can manage the app

GUI

Creating an application using the command line only

First, ensure that you’ve installed the AWS CLI and the aws eb command line utilities.

  1. eb init - Initializes your folder as an Elastic Beanstalk application
    • Choose your region (us-west-2)
    • Choose [Create new Application]
      • Note: If you already have an application, you could also choose that to connect
    • Answer the other questions as appropriate
      • Choose Node.js at the correct version
  2. eb create my-environment-name - Create an “environment” for your app to reside in
  3. eb deploy to deploy your new application to your new environment
    • You’ll also use this whenever you make code changes

You can then use some other eb commands to manage your apps

Auto-Deploy

You can also use GitHub Actions to auto-deploy your source code to your EB Environment whenever you check in your code.

Browse the GitHub Marketplace for actions you can import into your repo. There are many