{"id":20496339,"url":"https://github.com/amplify-education/serverless-vpc-discovery","last_synced_at":"2025-03-17T15:13:03.563Z","repository":{"id":20851487,"uuid":"91095927","full_name":"amplify-education/serverless-vpc-discovery","owner":"amplify-education","description":"Serverless plugin for discovering VPC / Subnet / Security Group configuration by name.","archived":false,"fork":false,"pushed_at":"2024-07-30T12:06:36.000Z","size":776,"stargazers_count":38,"open_issues_count":7,"forks_count":15,"subscribers_count":26,"default_branch":"main","last_synced_at":"2024-09-21T09:12:32.427Z","etag":null,"topics":["aws","discovery","ec2","lambda","serverless","serverless-plugin","subnet","vpc"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amplify-education.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-12T13:46:52.000Z","updated_at":"2023-02-27T12:44:12.000Z","dependencies_parsed_at":"2024-11-15T18:06:47.627Z","dependency_job_id":"1d59ce2f-0f30-43d7-b9d9-c458f8e0fac6","html_url":"https://github.com/amplify-education/serverless-vpc-discovery","commit_stats":{"total_commits":122,"total_committers":11,"mean_commits":"11.090909090909092","dds":0.4918032786885246,"last_synced_commit":"a71bb027a5b339ae235a6f0cef413754b5cc2411"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplify-education%2Fserverless-vpc-discovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplify-education%2Fserverless-vpc-discovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplify-education%2Fserverless-vpc-discovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amplify-education%2Fserverless-vpc-discovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amplify-education","download_url":"https://codeload.github.com/amplify-education/serverless-vpc-discovery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056425,"owners_count":20390719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","discovery","ec2","lambda","serverless","serverless-plugin","subnet","vpc"],"created_at":"2024-11-15T18:06:39.843Z","updated_at":"2025-03-17T15:13:03.537Z","avatar_url":"https://github.com/amplify-education.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serverless-vpc-discovery\n\n[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)\n[![Build Status](https://travis-ci.org/amplify-education/serverless-vpc-discovery.svg?branch=master)](https://travis-ci.org/amplify-education/serverless-vpc-discovery)\n[![npm version](https://badge.fury.io/js/serverless-vpc-discovery.svg)](https://badge.fury.io/js/serverless-vpc-discovery)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/amplify-education/serverless-vpc-discovery/master/LICENSE)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/8135a66ac35648758d22e242fbdbd732)](https://app.codacy.com/gh/amplify-education/serverless-vpc-discovery/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![npm downloads](https://img.shields.io/npm/dt/serverless-vpc-discovery.svg?style=flat)](https://www.npmjs.com/package/serverless-vpc-discovery)\n\nThe vpc discovery plugin takes the given vpc name, subnet tag key/value, and security group tag key/value or names in\nthe serverless file to setup the vpc configuration for the lambda.\n\nBasically we use this config:\n\n```\nvpcDiscovery:\n    vpcName: '\u003cvpc_name\u003e'\n    subnets:\n      - tagKey: \u003ctag_name\u003e\n        tagValues:\n          - '\u003ctag_vale\u003e'\n    securityGroups:\n      - tagKey: \u003ctag_name\u003e\n        tagValues:\n          - '\u003ctag_value\u003e'\n```\n\nTo generate this config:\n\n```\nvpc:\n    subnetIds:\n        - subnet-123456789\n        ...\n    securityGroupIds:\n        - sg-123456789\n        ...\n```\n\nFor each lambda function.\n\n\u003e Note: The core serverless `provider.vpc` settings will be used, if they are set, instead of `vpcDiscovery`. You can\n\u003e use also mix settings. For example you may set `provider.vpc.subnetIds` while using `vpcDiscovery` to set\n\u003e the `securityGroupIds`. Take a look\n\u003e at [official documentation](https://www.serverless.com/framework/docs/providers/aws/guide/functions#vpc-configuration).\n\n# About Amplify\n\nAmplify builds innovative and compelling digital educational products that empower teachers and students across the\ncountry. We have a long history as the leading innovator in K-12 education - and have been described as the best tech\ncompany in education and the best education company in tech. While others try to shrink the learning experience into the\ntechnology, we use technology to expand what is possible in real classrooms with real students and teachers.\n\nLearn more at https://www.amplify.com\n\n# Getting Started\n\n## Prerequisites\n\nMake sure you have the following installed before starting:\n\n* [nodejs](https://nodejs.org/en/download/)\n* [npm](https://www.npmjs.com/get-npm?utm_source=house\\\u0026utm_medium=homepage\\\u0026utm_campaign=free%20orgs\\\u0026utm_term=Install%20npm)\n* [serverless](https://serverless.com/framework/docs/providers/aws/guide/installation/)\n\nAlso allow the lambda to have the following IAM permissions:\n\n* ec2:CreateNetworkInterface\n* ec2:DescribeNetworkInterfaces\n* ec2:DeleteNetworkInterface\n\n## Installation\n\nRun:\n\n```\n# From npm (recommended)\nnpm install serverless-vpc-discovery\n\n# From github\nnpm install https://github.com/amplify-education/serverless-vpc-discovery.git\n```\n\nThen make the following edits to your serverless.yaml file:\n\n```yaml\nplugins:\n  - serverless-vpc-discovery\n\n# Optional: Either set `custom.vpcDiscovery` or `functions.\u003cfunction name\u003e.vpcDiscovery`\ncustom:\n  vpcDiscovery:\n    vpcName: '\u003cvpc_name\u003e'\n\n    # optional if `securityGroups` option is specified\n    # list of tag key and values \n    subnets:\n      - tagKey: \u003ctag_name\u003e\n\n        # an array of values\n        tagValues:\n          - '\u003ctag_value\u003e'\n\n    # optional if `subnets` option is specified\n    # list of tag key and value or names\n    securityGroups:\n      - tagKey: \u003ctag_name\u003e\n\n        # an array of values\n        tagValues:\n          - '\u003ctag_value\u003e'\n\n      # optional if `tagKey` and `tagValues` are specified\n      # an array of values\n      - names:\n          - '\u003csecurity_group_name\u003e'\n\n# Optional: Either set `custom.vpcDiscovery` or `functions.\u003cfunction name\u003e.vpcDiscovery`\nfunctions:\n  example:\n    handler: handler.example\n    # inherit `custom.vpcDiscovery` config in case `custom.vpcDiscovery` is specified\n\n  example2:\n    handler: handler.example\n\n    # skip vpc configuration for the current function\n    vpcDiscovery: false\n\n  example3:\n    handler: handler.example\n\n    # inherit `custom.vpcDiscovery` config in case `custom.vpcDiscovery` is specified and override security group names\n    vpcDiscovery:\n      vpcName: '\u003cvpc_name\u003e'\n      securityGroups:\n        - tagKey: \u003ctag_name\u003e\n\n          # an array of values\n          tagValues:\n            - '\u003ctag_value\u003e'\n\n  example4:\n    handler: handler.example\n    # override or set basic subnets and security groups items\n    vpcDiscovery:\n      vpcName: '\u003cvpc_name\u003e'\n\n      # optional if `custom.vpcDiscovery.securityGroups` option is specified\n      subnets:\n        - tagKey: \u003ctag_name\u003e\n\n          # an array of values\n          tagValues:\n            - '\u003ctag_value\u003e'\n\n      # optional if `custom.vpcDiscovery.subnets` option is specified\n      securityGroups:\n\n        # optional if `names` option is specified\n        - tagKey: \u003ctag_name\u003e\n\n          # an array of values\n          tagValues:\n            - '\u003ctag_value\u003e'\n\n        # optional if `tagKey` and `tagValues` are specified\n        # an array of values\n        - names:\n            - '\u003csecurity_group_name\u003e'\n```\n\n## Running Tests\n\nTo run the test:\n\n```\nnpm test\n```\n\nAll tests should pass.\n\nTo run integration tests, set an environment variable TEST\\_VPC\\_NAME to the VPC you will be testing for. Then,\n\n```\nexport AWS_PROFILE=your_profile\nexport TEST_VPC_NAME=vpc_name\nnpx npm run build\nnpx npm run integration-test\n```\n\nIf there is an error build and install the node\\_module inside the serverless-vpc-discovery folder:\n\n```\nnpm build\nnpm install .\n```\n\n## Deploying with the plugin\n\nWhen deploying run:\n\n```\nserverless deploy\n```\n\nAnd that should be it! Good Luck!\n\n# How it Works\n\nThe vpc, subnets, and security groups are found by filtering based on a specified tag name.\nVpc and subnets are found under the tag name `tag:Name`.\nSecurity groups are found by the name of the group under `group-name`.\n\nThe vpc is found first as it is used to find the subnets and security groups. Once all of the subnets and security\ngroups are found the serverless service provider creates a vpc object and stores the subnets and security groups.\n\n# Responsible Disclosure\n\nIf you have any security issue to report, contact project maintainers privately.\nYou can reach us at \u003cgithub@amplify.com\u003e\n\n# Contributing\n\nWe welcome pull requests! For your pull request to be accepted smoothly, we suggest that you:\n\n1. For any sizable change, first open a GitHub issue to discuss your idea.\n2. Create a pull request. Explain why you want to make the change and what it’s for.\n   We’ll try to answer any PR’s promptly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famplify-education%2Fserverless-vpc-discovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famplify-education%2Fserverless-vpc-discovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famplify-education%2Fserverless-vpc-discovery/lists"}