List of Helpful AWS Resources
References
- AWS CLI Command Reference
- AWS SAM CLI Command Reference
- AWS Management Console Documentation
- Understanding AWS Regions
- AWS SAM Specification
- AWS identity management: Users
AWS Consoles
When accessing these consoles, make sure to notice the region that you have elected to use.
- Service quotas: To check your service quotas---a small quota that can be assigned to new users can limit performance significantly (see Load testing).
- CloudWatch console: View logs and performance
- DynamoDB console: Configure and view DynamoDB databases
- CloudFormation console: View your application stacks
- ECR console: View your ECR repositories---less important, only when you want to fully delete your application.
Get support from AWS
AWS free tier is highly flexible, but getting access to AWS help desk can also be helpful.
- AWS Support Plan Pricing
- To upgrade to the Developer support plan: Go to the AWS Support Console and change the support plan using the button near the top left corner.
- Once you do that, you can create a support case to ask your question.
Create and deploy a serverless application
Initialize a new serverless application using sam init
.
Build and deploy a serverless application:
After a stack has been created, the --guided
flag is no longer required. You can push local changes to the cloud using:
Collaborating on Applications
We should note that if multiple individuals on a research team create separate applications using sam build
and sam deploy --guided
, these applications will have different URL endpoints. Therefore, once a survey is set up to work with a specific URL, updates to must be made to the correct application, and you must use the AWS URL associated with the user who pushed the required changes. In the future, we will add instructions for best practices that can be used when collaborating across individuals.
Testing and Debugging Your Application
Testing Locally
To run and test your AWS Lambda function locally, you can use the command sam local start-api
. This command builds your function in a local Docker container that you can query from a local HTTP server endpoint (default host: http://localhost:3000/
).
We created a Jupyter notebook that allows you to run sample queries for debugging your location locally: /tools/API_notebooks/API_Queries_Local.ipynb
. To debug your application with this method, you should:
- Run
sam build
to build the current version of your application. - Run
sam local start-api
. - Use
/tools/API_notebooks/API_Queries_Local.ipynb
to query your application or query the application directly usingcurl http://localhost:3000/
. - If you need to make changes to your local code, make sure to run
sam build
again so that these changes are reflected in the local version of your application.
Note that the speed of the application when testing locally depends on your computer's resources and hardware; therefore, speeds may differ drastically from what you can expect when the application is hosted in the cloud. Typically, local testing will result in much slower queries than what you can expect in the cloud.
Testing in the Cloud
Once you have deployed your application in the cloud using sam deploy
, you can query your application. We created a notebook that you can use to test out the main API calls: /tools/API_notebooks/API_Queries.ipynb
.
Follow this notebook to query your API on the cloud.
If your application is not working correctly, you can view your application's logs using two methods.
- View recent logs from the command line using
sam logs --stack-name <stack-name> --tail
. - View logs directly using the AWS CloudWatch console.
Alternatively, you can find logs for your applications within the CloudWatch console.
Save DynamoDB Data
We provide a script to help you save the contents from your DynamoDB database to a CSV file. From /data
, run python save_data.py
. This will create the /data/dynamodb_contents.csv
file.