Skip to content

Nxtra/awslambda-mongodb-vpc-peering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Lambda MongoDB Vpc Peering

This repository demonstrates how a Lambda Function needs to be configured to save items in MongoDB. To connect to the MongoDB cluster vpc-peering is used.

Prerequisites

UPDATES

You need to update certain config values in this project to make it work for your own vpc!

In template.yaml:

  • update the environment variable that specifies the connection string, database and collection to your own connection string, database and connection.
      Environment:
        Variables:
          MONGODB_CONNECTION_STRING: mongodb+srv://<user>:<password>@<your-cluster>.mongodb.net/test?retryWrites=true&w=majority
          DATABASE: yourDatabaseName
          COLLECTION: yourCollectionName
    
  • update the VpcConfig with your own vpc security group and subnet:
      VpcConfig:
        SecurityGroupIds:
          - sg-08b12e8bdf431b849
        SubnetIds:
          - subnet-08a19d1a47914c5ac

Deploy

From the root directory run ./deploy.sh

This will:

  • install the needed dependencies
  • zip your code
  • deploy the lambda function

Answer y on the input that is asked.

When you have deployed successfully you could change the last line of the script sam deploy --guided to sam deploy.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published