Giter Club home page Giter Club logo

pokemon-iac's Introduction

What is this?

This is a toy project set up for the purpose of learning Terraform and becoming more comfortable with some AWS services.

The initial idea was to: - have the ability to trigger an api gateway endpoint to populate a dynamo database with via a lambda - be able to retrieve stored data through api gateway endpoint

Usage

Terraform

I am using aws-vault as a way interact with AWS

  • create tfvars (see dev.ftvars.example) file and supply all values
  • first run will require terraform init to download dependancies
  • (optional) aws-vault exec {profile name} -- terraform plan -var-file="{choose name}.tfvars" to create execution plan and review expected changes
  • aws-vault exec {profile name} -- terraform apply -var-file="{choose name}.tfvars" to execute the plan and create resources in AWS
  • aws-vault exec beattie19 -- terraform destroy -var-file="{choose name}.tfvars" when finished to remove resources from AWS

Application

Once the terraform apply is successful there should be some outputs on the cli

  • /populate - Path to populate database with Pokemon data
  • /all-pokemon - Path retrieve all Pokemon data

TODO

Docs

  • Create a better usage section
  • Add screenshots from Miro

Code

  • Come up with a new solution that won't take down the database on destroy
  • Pass SQS queue into the lambda event so it's not hard coded
  • Improve lambda for creating messages (may currently timeout) - may want a lambda that triggers a lambda.
  • Some duplication in API Gateway, consider creating a module.

Potential things to try

  • It would be good to be able to test locally
    • could localstack work for my usecase?
  • Should I consider SAM for the lambda/api gateway instead?
  • Can docker fit into this in anyway
  • Add testing
    • terratest?
  • Consider CI/CD? - could have build steps for testing

How we populate the data in DynamoDB?

  • Hit the /populate endpoint
  • Trigger lambda to create SQS messages for each pokemon
  • Each message is picked up by a lambda which reached out to the pokemon api and populates dynamo

Useful tips:

You can set the concurrency for a lambda to zero (or click Throttle) to ensure the lambda is not invoked - This could allow the message to remain on the queue for inspection.

pokemon-iac's People

Contributors

beattie19 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.