Having the AWS CLI (Command Line Interface) installed helps get the credentials set up locally for running shell commands to create resources inside of AWS. Follow the instructions from AWS' official documenation page to get it installed.
A serverless version of this application has been established by leveraging the aws-serverless-express npm module. This module wraps an Express app so that it conforms to AWS Lambda handler method signatures and can be deployed into Lambda, yet it uses Express' router to route and deliver the requests to the appropriate controllers.
See AWS' official documentation for the latest instructions for installing the SAM CLI. The abridged version is this:
-
Make sure python 2.7 is installed
python --version -
Update pip
pip install --user --upgrade pip -
Install aws-sam-cli
pip install --user aws-sam-cli -
Verify sam successfully installed
sam --version
pip show -f aws-sam-cli
Should show where files were installed:
Name: aws-sam-cli
Version: 0.3.0
Summary: AWS SAM CLI is a CLI tool for local development and testing of Serverless applications
Home-page: https://github.com/awslabs/aws-sam-cli
Author: Amazon Web Services
Author-email: aws-sam-developers@amazon.com
License: Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Location: /Users/rjensen/Library/Python/2.7/lib/python/site-packages
Requires: six, click, enum34, Flask, boto3, PyYAML, cookiecutter, aws-sam-translator, docker
Required-by:
Files:
../../../bin/sam
aws_sam_cli-0.3.0-py2.7.egg-info
aws_sam_cli-0.3.0-py2.7.egg-info/PKG-INFO
aws_sam_cli-0.3.0-py2.7.egg-info/SOURCES.txtThe "../../../bin/sam" entry (will be different depending on what directory you are currently in) shows where the sam executable was installed to. Ensure this absolute path is included in your PATH variable. If it is not, edit your ~/.bash_profile file to do so. This absolute path can be found by running:
python -m site --user-base
If this wasn't your issue, refer to the official AWS documenation mentioned above.
- Go to https://aws.amazon.com & click sign-up
- Enter personal and billing information
- Verify info by allowing AWS to call your entered phone number and type the verification code on your phone
- Go to http://console.aws.amazon.com/
- Enter root account username and password
- you may need to enter CAPTCHA info on first login
Other than to create auxiliary users or requesting service line increases, the root account should NEVER be used for signing in to AWS. Follow these steps to set up a minimal admin user to use for the rest of this setup.
- Go to AWS' IAM service to manage users
- Click the 'Add user' button
- Provide a username and password
- Specify that this user should have programmatic and console access
- Proceed to Permissions...
- Click the 'Attach existing policies directly' tab
- Select 'AdministratorAccess'
- Click 'Review'
- Click 'Create'
- Copy the 'Access key ID' and the 'Secret access key' from this screen
- THIS IS THE ONLY TIME YOU WILL HAVE ACCESS TO THE 'SECRET ACCESS KEY', SO MAKE SURE YOU SAVE IT SOMEWHERE BEFORE PROCEEDING
- Use the AWS CLI (installed near the beginning of this document) to add these access keys
- From your command line, type
aws configure - Enter your Access Key
- Enter your Secret Key
- Enter 'us-east-1' for the 'Default region name'
- From your command line, type
To deploy the serverless version of this code, you will need to create a secured "bucket" in AWS' storage service.
From your command line,
aws s3 mb s3://sam-skeleton