Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VPC and EFS support for lambda functions #196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,19 @@ highlanderdocoexample:
schedules:
- cronExpression: 'rate(1 minute)'
payload: '{ "message": "ping" }'

# (optional) associate the function with a VPC
# both security_group_ids and subnet_ids are lists, so either substitute a list like below or define it as a yaml list
vpc:
security_group_ids: !Ref ExampleSecurityGroup
subnet_ids: !Ref SubnetIds

# (optional) associate the function with an Elastic File System
# need to reference an access point for the function to attach to
# local_mount_path needs to start with /mnt/ like below
filesystem:
access_point_arn: !Ref ExampleAccessPoint
local_mount_path: "/mnt/efs0"
```


Expand Down
12 changes: 10 additions & 2 deletions cfndsl_ext/lambda_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,17 @@ def render_lambda_functions(cfndsl, lambdas, lambda_metadata, distribution)
Runtime(lambda_config['runtime'])
Timeout(lambda_config['timeout'] || 10)
if !lambda_config['vpc'].nil? && lambda_config['vpc']
# TODO implement VPC config
vpc_config = {}
vpc_config[:SecurityGroupIds] = lambda_config['vpc']['security_group_ids']
vpc_config[:SubnetIds] = lambda_config['vpc']['subnet_ids']
VpcConfig(vpc_config)
end
if !lambda_config['filesystem'].nil? && lambda_config['filesystem']
filesystem_config = {}
filesystem_config[:Arn] = lambda_config['filesystem']['access_point_arn']
filesystem_config[:LocalMountPath] = lambda_config['filesystem']['local_mount_path']
FileSystemConfigs(filesystem_config)
end

if !lambda_config['named'].nil? && lambda_config['named']
if lambda_config['function_name'].nil?
FunctionName(name)
Expand Down
Loading