-
Notifications
You must be signed in to change notification settings - Fork 2.4k
docs: add hello world example with VPCConfig #551
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
Conversation
cc @brettstack |
'use strict'; | ||
console.log('Loading function'); | ||
|
||
exports.handler = (event, context, callback) => { |
There was a problem hiding this comment.
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!'
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodejs8.10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"It primary" => "It primarily"
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
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.