Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 2.89 KB

README.md

File metadata and controls

61 lines (42 loc) · 2.89 KB

t-rss-reader infra

Set up and tear down these resources in AWS via Terraform:

  • DynamoDB tables
  • Lambda functions
  • API Gateways
  • IAM roles and policies

Endpoints

After creating all the resources you end up with these endpoints:

  • /login
  • /feeds
    • GET gets all feeds
    • PUT upserts a feed
    • DELETE deletes a feed
  • /entries?url=[FEED_URL]
    • GET gets a feed's entries
  • /last-access
    • PUT upserts a timestamp of the last time the application was accessed

See lambda function handler code for the exact interfaces.

Prerequisites

Assumes a Unix-like system (e.g. Linux, macOS) with make and zip installed.

Setup

  1. Change the Terraform Cloud organization in main.tf to yours (this value is not possible to declare as a variable)
  2. terraform login
  3. Generate a password to use for authenticating client requests in the application
  4. Create a terraform.tfvars file from the terraform-example.tfvars file
  5. Add your generated password and AWS access keys to the terraform.tfvars file
  6. make init

Create and delete resources

  • make create to create the resource creation plan and apply it
  • make delete to create the resource deletion plan and apply it

Cost

All resources have generous limits within the AWS Free Tier.

In most cases it costs nothing to run this infrastructure.

Use your own discretion when evaluating costs. It goes without saying, but I am not responsible for any unintended costs incurred by your use of these templates.

Gotchas

  • Terraform always updates the lambda functions despite the hash of the output files not changing. It's a known issue that's not worth fixing at this scale.
  • Terraform sometimes throws a concurrent modification error when creating routes. It looks like this: Error: creating API Gateway v2 route: ConflictException: Unable to complete operation due to concurrent modification. Please try again later. Re-run make create and the routes not created from the last run will be created. This only happens when all routes are created at once so it doesn't happen enough to make it worth fixing.
  • Terraform sometimes doesn't pick up certain changes when diffing, such as DyanmoDB attributes. Run make destroy and make create to have them applied. This will erase all database items, so beware. Also doesn't happen enough to make it worth fixing.