Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions examples/2016-10-31/hello_world_vpc/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';
console.log('Loading function');

exports.handler = (event, context, callback) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll soon be able to do hello-world examples (examples where the function logic itself isn't important) like this:

InlineCode: exports.handler = async () => 'Hello world!'

InlineCode has been merged into develop and will go out in the next release. Until then, we can just set this file to simply be exports.handler = async () => 'Hello world!'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's pretty cool!!!! Changed file following this format

callback(null, 'Hello World!');
};
20 changes: 20 additions & 0 deletions examples/2016-10-31/hello_world_vpc/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A hello world application with VPC Access.

Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs6.10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nodejs8.10

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

CodeUri: src/
Policies:
- VPCAccessPolicy: {}
# This policy gives permission for Lambdas to create/manage ENIs
# SAM Policy templates you can use: https://github.com/awslabs/serverless-application-model/blob/develop/examples/2016-10-31/policy_templates/all_policy_templates.yaml
VpcConfig:
SecurityGroupIds:
- String # add Security Group ID(s) for this Lambda
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer the example to either create the SecurityGroupId(s) and SubnetId(s) or accept them as Parameters and !Ref them here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

SubnetIds:
- String # add VPC Subnet(s) for this Lambda