Skip to content

Conversation

heitorlessa
Copy link
Contributor

Issue #, if available: Issue created in SAM CLI: aws/aws-sam-cli#617

Description of changes:

Adds a hello world VPC example to demonstrate how to add correct permissions for Lambda VPC enabled using SAM Policy Templates including link to the docs for other examples.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@heitorlessa
Copy link
Contributor Author

cc @brettstack

@brettstack brettstack changed the title feat: Adds hello world VPC with comments and links to the docs docs: add hello world example with VPCConfig Aug 16, 2018
@brettstack brettstack changed the base branch from master to develop August 16, 2018 19:50
@brettstack brettstack self-assigned this Aug 16, 2018
'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

# 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

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

Copy link
Contributor

@brettstack brettstack left a comment

Choose a reason for hiding this comment

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

Just a couple of issues in the README but looks good! 👍


# Lambda function with VPC Access

This example shows you how to create a Lambda function in VPC with the appropriate permissions using SAM. It primary aims to demonstrate Cloudformation parameters as well as a simplified configuration made possible with SAM Policies, therefore it'll not utilise API Gateway or any other Event source and as a result only the account owner can invoke it.
Copy link
Contributor

Choose a reason for hiding this comment

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

"It primary" => "It primarily"

Copy link
Contributor

Choose a reason for hiding this comment

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

"Lambda function in VPC" => "Lambda function in a VPC"?

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!

@keetonian keetonian merged commit 176ec88 into aws:develop Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants