Skip to content

List of Helpful AWS Resources

References

AWS Consoles

When accessing these consoles, make sure to notice the region that you have elected to use.

Get support from AWS

AWS free tier is highly flexible, but getting access to AWS help desk can also be helpful.

Create and deploy a serverless application

Initialize a new serverless application using sam init.

Build and deploy a serverless application:

sam build
sam deploy --guided

After a stack has been created, the --guided flag is no longer required. You can push local changes to the cloud using:

sam build
sam deploy

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 using curl 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.