You are previewing Beginning Amazon Web Services with Node.js.
O'Reilly logo
Beginning Amazon Web Services with Node.js

Book Description

Beginning Amazon Web Services with Node.js teaches any novice Node.js developer to configure, deploy, and maintain scalable small to large scale Node.js applications in Amazon Web Services. Hosting a Node.js application in a production environment usually means turning to PaaS hosting, but this approach brings problems. Deploying Node.js directly to AWS solves the problems you encounter in these situations, enabling you to cut out the middle man.

You will begin with a basic RESTful web service in Node.js, using the popular Express.js framework, pre-built and ready to run in your local environment. You will be introduced to the most powerful tools in AWS, and learn how to configure your project to take advantage of them. You will be guided through the steps of getting the various key components to work together on AWS. Through code samples using the AWS JavaScript SDK and tutorials in the AWS console, you will gain the knowledge to incorporate secure user authentication, server auto-scaling, a load balancer, CDN, customized caching behavior, and outage monitoring.

Node.js is single-threaded, and designed to run high input / high output applications, making it ideal for the cloud environment. If your main task is handling a high volume of requests over HTTP / the web, it will scale very well in proportion to the computing power you allocate to it. Amazon Web Services offers a broad set of services that help organizations move faster, lower costs, and scale applications. Trusted by the largest enterprises and start-ups alike, AWS powers a wide variety of workloads across a broad spectrum. If leveraged properly, you can build a Node.js app on AWS which can automatically power itself up to handle a massive volume of traffic, and then scale back down to a lighter configuration when user demand has dropped. Amazon Web Services offers a broad set of services that help organizations move faster, lower costs, and scale applications. Get started with Node.js and AWS using this book today.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Author
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Preface
  11. Chapter 1: Getting Started with Amazon Web Services
    1. Understanding the Cloud
    2. The Approach in This Book
    3. Requirements
      1. AWS Account
      2. Domain Registration
      3. SSL Certificate
      4. Code Repository
      5. Download the Sample Project
      6. Local Environment
      7. ExpressJS
    4. Sample Project
      1. Overview
      2. Source Code Organization
      3. Configuration and Startup
      4. Working with the Sample App
      5. Albums
      6. Photos
      7. Developing with the Sample App
    5. Identity and Access Management
      1. The IAM Dashboard
      2. IAM Users
      3. IAM Groups
      4. IAM Managed Policies
      5. IAM Permissions Editor
    6. Summary
  12. Chapter 2: Working with AWS OpsWorks
    1. Understanding OpsWorks
    2. Allocating Resources
    3. Regions and Availability Zones
    4. Additional IAM Roles
      1. Instance Role
      2. Service Role
    5. The OpsWorks Environment
    6. The OpsWorks Dashboard
      1. Stacks
      2. Layers
      3. Apps
      4. Deploying Your App
    7. Summary
  13. Chapter 3: OpsWorks Part II: Databases and Scaling
    1. Relational Database Service (RDS)
      1. Multi-AZ Deployment
      2. Read Replicas
      3. Provisioned IOPS Storage
      4. DB Security Groups
      5. Creating an RDS Database
      6. Database Import
      7. OpsWorks RDS Layer
      8. Environments and Environment Variables
      9. Stack Commands: Backup Scenario
    2. Elastic Load Balancing (ELB)
      1. Creating a Load Balancer
      2. OpsWorks ELB Layer
      3. Adding a New Instance
    3. Summary
  14. Chapter 4: CloudFront and DNS Management
    1. CloudFront
      1. Creating the Distribution
      2. Configuring the Distribution
      3. Distribution Detail View
      4. Behavior with Query Strings
      5. Deploy Code Changes
      6. Add New Behavior
      7. Caching
    2. Route 53
    3. Summary
  15. Chapter 5: Simple Storage Service and Content Delivery
    1. Using S3 in the Application
      1. Creating an S3 Bucket
    2. Enabling S3 Access in IAM
      1. Storing Credentials
      2. Implementing IAM Roles
      3. Using IAM User Credentials
    3. Adding OpsWorks Environment Variables
    4. Developing with the AWS SDK
      1. Updating Dependencies
      2. Accessing Environment Variables
      3. Handling File Uploads
      4. Updating the Database Schema
    5. Integrating with CloudFront
      1. Creating CloudFront S3 Origin
      2. CloudFront S3 Behavior
    6. Finishing Touches
      1. Absolute URLs
      2. Enhanced Image Caching
    7. Summary
  16. Chapter 6: Simple Email Service
    1. Introducing Simple Email Service
      1. Exploring the SES Dashboard
      2. SES Verification
    2. Managing SES Permissions with IAM
    3. Using SES with the AWS SDK
      1. Globals
      2. Mail.js
      3. User Registration Route
      4. Deployment and Testing
    4. AWS Resource Groups
      1. Tagging Resources
      2. Creating and Viewing Resource Groups
    5. Summary
  17. Chapter 7: Monitoring the Application
    1. CloudWatch
    2. CloudWatch Alarms
      1. Alarm Periods
      2. Simple Notification Service (SNS)
      3. Creating a CloudWatch Alarm
      4. Defining an Alarm
      5. Alarm State
    3. Using OpsWorks with CloudWatch
      1. Load-Based Instances
      2. OpsWorks Auto-scaling Rules
      3. Time-Based Instances
      4. RDS Alarms
    4. CloudWatch Logs
      1. EC2 Instance Roles
      2. Using Chef in OpsWorks
      3. CloudWatch Logs
    5. Summary
  18. Chapter 8: Securing the Application
    1. Using HTTPS
    2. SSL Certificate Generation
      1. Installing OpenSSL
      2. Creating a Key and CSR
      3. Request Certificate
    3. The AWS Command-Line Interface (CLI)
      1. Configuring Permissions
      2. Uploading the SSL Certificates
      3. Enabling HTTPS in CloudFront
      4. Enabling HTTPS in ELB
    4. Application Security
      1. Adding Session and Encryption Modules
      2. Adding Password Encryption
      3. Using Secure Sessions
    5. Conclusion
  19. Index