Skip to content

About

Infra as Code to spin up resources on aws to run the serverless user-application, that allows user to register and verify

Resources

Stars

0 stars

Watchers

2 watching

Forks

Repository files navigation

IaC-Serverless

Overview

Infra as Code to spin up resources on aws to run the serverless user-application, that allows to register and verify the user

Architecture

Tools required

  1. git
    brew install git
  2. terraform
    brew tap hashicorp/tap
    brew install hashicorp/tap/terraform
  3. aws-cli
    brew install awscli
  4. tflint
    brew install tflint
  5. tfsec
    brew install tfsec
  6. terraform-docs
    brew install terraform-docs

How to Run

  1. Sign-in to aws,
aws sso login --profile {profile} && export AWS_PROFILE={profile}
  1. Create pre-requisite resources,
cd tf_prerequisites/
terraform apply
  1. Create the remaining resources manually or via pipeline,
terraform init
terraform validate
terraform plan --var-file=environments/dev.tfvars
#   terraform apply --var-file=environments/dev.tfvars
#   terraform output
#   terraform destroy
  1. Execute tf-tools commands - to be used prior to every commit,
terraform fmt -recursive
terraform-docs markdown table --output-file README.md .
tflint --recursive
tfsec .

How to Test :

Curl :

Register user ->

curl -X POST '{user_app_url_from_terraform_output}/register?UserId=Raj7'

Verify user ->

curl -X POST '{user_app_url_from_terraform_output}/?UserId=Raj7' > verified_user.html

Output :

Register user ->

Verify user ->

FinOps

Refer the detailed cost estimates file for detailed rough cost estimates generated via Cost calculator

   	"Total Cost": {
   	"monthly": "21.29",
   	"upfront": "0.00",
   	"12 months": "255.48"
   }

########################## Terraform docs generated using terraform-docs ##########################

Requirements

Name Version
terraform >= 1.9.8
aws = 5.72.1

Providers

No providers.

Modules

Name Source Version
api_gateway ./modules/apigateway n/a
dynamodb_table ./modules/dynamodb n/a
lambda_function ./modules/lambda n/a
s3 ./modules/s3 n/a

Resources

No resources.

Inputs

Name Description Type Default Required
bucket_name bucket name for storing static html contents string n/a yes
db_name Database name for storing users string n/a yes
environment environment to deploy the resources string n/a yes
lambda_functions map of functions and the source code path that needs to be deployed map(string) n/a yes
prefix prefix used for naming resources string "iac-serverless-raj" no
region region for creating all resources string n/a yes

Outputs

Name Description
database_arn arn of dynamodb used for storing users
s3_arn arn of s3 store that contains static html contents
user_app_url url of the user app

About

Infra as Code to spin up resources on aws to run the serverless user-application, that allows user to register and verify

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages