-
-
Save furuya02/aed2ac866fb7441fd99190719840fe87 to your computer and use it in GitHub Desktop.
CloudFormation Sample with Lambda function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: CloudFormation Sample with Lambda function | |
Resources: | |
LambdaFunction: | |
Type: AWS::Lambda::Function | |
DependsOn: | |
- LambdaRole | |
Properties: | |
Description: Lambda sample called from Connect | |
Code: | |
ZipFile: !Sub | | |
exports.handler = async function(event, context) { | |
return {message: "Welcome to Class Method Inc."}; | |
} | |
Handler: index.handler | |
Role: !GetAtt | |
- LambdaRole | |
- Arn | |
Runtime: nodejs8.10 | |
Timeout: 8 | |
MemorySize: 128 | |
LambdaRole: | |
Type: AWS::IAM::Role | |
Properties: | |
AssumeRolePolicyDocument: | |
Version: 2012-10-17 | |
Statement: | |
Effect: Allow | |
Principal: | |
Service: | |
- lambda.amazonaws.com | |
Action: | |
- sts:AssumeRole | |
ManagedPolicyArns: | |
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | |
# Connectから呼び出すためのパーミッション | |
LambdaFunctionInvokePermission: | |
Type: AWS::Lambda::Permission | |
DependsOn: LambdaFunction | |
Properties: | |
FunctionName: | |
Ref: LambdaFunction | |
Action: lambda:InvokeFunction | |
Principal: connect.amazonaws.com | |
SourceAccount: | |
Ref: AWS::AccountId | |
Outputs: | |
# 問い合わせフローに設定するLambdaのARN | |
LambdaARN: | |
Description: ARN of the Lambda function | |
Value: | |
Fn::GetAtt: | |
- LambdaFunction | |
- Arn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment