Deploy the Sample Application
Now your environment is ready for you to deploy the sample application to it and then run it.
Note
Download the source bundle from GitHub if you haven't already:eb-node-express-sample-v1.1.zip.
To deploy a source bundle
- Open the Elastic Beanstalk console.
- Navigate to the management page for your environment.
- Choose Upload and Deploy.
- Choose Choose File and use the dialog box to select the source bundle.
- Choose Deploy.
- When the deployment completes, choose the site URL to open your website in a new tab.
The site collects user contact information and uses a DynamoDB table to store the data. To add an entry, choose
Sign up today, enter a name and email address, and then choose Sign Up!. The web app writes the form contents to the table and triggers an Amazon SNS email notification
Right now, the Amazon SNS topic is configured with a placeholder email for notifications. You will update the configuration soon, but in the meantime you can verify the DynamoDB table and Amazon SNS topic in the AWS Management Console.
To view the table
- Open the Tables page in the DynamoDB console.
- Find the table that the application created. The name starts with awseb and contains StartupSignupsTable.
- Select the table, choose Items, and then choose Start search to view all items in the table.
The table contains an entry for every email address submitted on the signup site. In addition to writing to the table, the application sends a message to an Amazon SNS topic that has two subscriptions, one for email notifications to you, and another for an Amazon Simple Queue Service queue that a worker application can read from to process requests and send emails to interested customers.
To view the topic
- Open the Topics page in the Amazon SNS console.
- Find the topic that the application created. The name starts with awseb and contains NewSignupTopic.
- Choose the topic to view its subscriptions.
The application (app.js) defines two routes. The root path (/) returns a webpage rendered from an Embedded JavaScript (EJS) template with a form that the user fills out to register their name and email address. Submitting the form sends a POST request with the form data to the/signuproute, which writes an entry to the DynamoDB table and publishes a message to the Amazon SNS topic to notify the owner of the signup.
The sample application includes configuration files that create the DynamoDB table, Amazon SNS topic, and Amazon SQS queue used by the application. This lets you create a new environment and test the functionality immediately, but has the drawback of tying the DynamoDB table to the environment. For a production environment, you should create the DynamoDB table outside of your environment to avoid losing it when you terminate the environment or update its configuration.