Coder Social home page Coder Social logo

juanultimate / lambda-api-gateway-infrastructure Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4 KB

This project provides the required AWS resources to deploy an AWS lambda function.

JavaScript 7.65% HCL 92.35%
terraform aws-lambda serverless infraestructure-as-a-code aws aws-s3 aws-cloudwatch

lambda-api-gateway-infrastructure's Introduction

AWS lambda function infrastructure

This project provides the required AWS resources to deploy an AWS lambda function.

Prerequisites

How to run

  • Provide your AWS credentials
    export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
    export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
    
    Make sure the user has the enough permissions to create all the resources listed in resources.tf.
  • Initialize the configuration.
    terraform init
    
  • Apply the configuration. ๐Ÿš€
    terraform apply
    
    If everything was good, you will get an output similar to this:
    Apply complete! Resources: 13 added, 0 changed, 0 destroyed.
    
    Outputs:
      base_url = "https://abcdef0j.execute-api.us-east-1.amazonaws.com/serverless_lambda_stage"
      function_name = "HelloWorld"
      lambda_bucket_name = "juanultimate-lightly-finally-brave-caribou"
    
    

Troubleshooting

If you get an error like this:

โ•ท
โ”‚ Error: Error creating S3 bucket: AccessDenied: Access Denied
โ”‚ 	status code: 403, request id: 6AYNH133YN6YSYH2, host id: Je2lZ1ceKDqxDZjUq321GzoY+FXDRB0uuRaddAExample=
โ”‚
โ”‚   with aws_s3_bucket.lambda_bucket,
โ”‚   on main.tf line 31, in resource "aws_s3_bucket" "lambda_bucket":
โ”‚   31: resource "aws_s3_bucket" "lambda_bucket" {
โ”‚
โ•ต
โ•ท
โ”‚ Error: Error creating IAM Role serverless_lambda: AccessDenied: User: arn:aws:iam::129900831382:user/terraform-client is not authorized to perform: iam:CreateRole on resource: arn:aws:iam::129900831382:role/serverless_lambda
โ”‚ 	status code: 403, request id: 8e905153-4912-441f-bffd-61ce2a42e51a
โ”‚
โ”‚   with aws_iam_role.lambda_exec,
โ”‚   on main.tf line 74, in resource "aws_iam_role" "lambda_exec":
โ”‚   74: resource "aws_iam_role" "lambda_exec" {
โ”‚
โ•ต
โ•ท
โ”‚ Error: error creating API Gateway v2 API: AccessDeniedException: User: arn:aws:iam::129900831382:user/terraform-client is not authorized to perform: apigateway:POST on resource: arn:aws:apigateway:us-east-1::/apis
โ”‚
โ”‚   with aws_apigatewayv2_api.lambda,
โ”‚   on main.tf line 96, in resource "aws_apigatewayv2_api" "lambda":
โ”‚   96: resource "aws_apigatewayv2_api" "lambda" {
โ”‚
โ•ต

It means your user does not have the enough permission to create the required resources.

lambda-api-gateway-infrastructure's People

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.