Last active
December 9, 2018 15:20
-
-
Save qtangs/5bd6d84dc6e4839b1c87665fa48ccd3f to your computer and use it in GitHub Desktop.
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": "The AWS CloudFormation template for this Serverless application", | |
"Resources": { | |
"ServerlessDeploymentBucket": { | |
"Type": "AWS::S3::Bucket" | |
}, | |
"DataAnalysisLogGroup": { | |
"Type": "AWS::Logs::LogGroup", | |
"Properties": { | |
"LogGroupName": "/aws/lambda/sample-service-dev-DataAnalysis" | |
} | |
}, | |
"IamRoleLambdaExecution": { | |
"Type": "AWS::IAM::Role", | |
"Properties": { | |
"AssumeRolePolicyDocument": { | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"Service": [ | |
"lambda.amazonaws.com" | |
] | |
}, | |
"Action": [ | |
"sts:AssumeRole" | |
] | |
} | |
] | |
}, | |
"Policies": [ | |
{ | |
"PolicyName": { | |
"Fn::Join": [ | |
"-", | |
[ | |
"dev", | |
"sample-service", | |
"lambda" | |
] | |
] | |
}, | |
"PolicyDocument": { | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"logs:CreateLogStream" | |
], | |
"Resource": [ | |
{ | |
"Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/sample-service-dev-DataAnalysis:*" | |
} | |
] | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"logs:PutLogEvents" | |
], | |
"Resource": [ | |
{ | |
"Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/sample-service-dev-DataAnalysis:*:*" | |
} | |
] | |
} | |
] | |
} | |
} | |
], | |
"Path": "/", | |
"RoleName": { | |
"Fn::Join": [ | |
"-", | |
[ | |
"sample-service", | |
"dev", | |
"ap-southeast-1", | |
"lambdaRole" | |
] | |
] | |
} | |
} | |
}, | |
"PandasLambdaLayer": { | |
"Type": "AWS::Lambda::LayerVersion", | |
"Properties": { | |
"Content": { | |
"S3Bucket": { | |
"Ref": "ServerlessDeploymentBucket" | |
}, | |
"S3Key": "serverless/sample-service/dev/1544262539428-2018-12-08T09:48:59.428Z/Pandas.zip" | |
}, | |
"LayerName": "sample-service-Python36-Pandas23x", | |
"Description": "Pandas 0.23.x with Python 3.6", | |
"LicenseInfo": "MIT License", | |
"CompatibleRuntimes": [ | |
"python3.6" | |
] | |
} | |
}, | |
"PandasWildLambdaLayerPermission": { | |
"Type": "AWS::Lambda::LayerVersionPermission", | |
"Properties": { | |
"Action": "lambda:GetLayerVersion", | |
"LayerVersionArn": { | |
"Ref": "PandasLambdaLayer" | |
}, | |
"Principal": "*" | |
} | |
}, | |
"DataAnalysisLambdaFunction": { | |
"Type": "AWS::Lambda::Function", | |
"Properties": { | |
"Code": { | |
"S3Bucket": { | |
"Ref": "ServerlessDeploymentBucket" | |
}, | |
"S3Key": "serverless/sample-service/dev/1544262539428-2018-12-08T09:48:59.428Z/DataAnalysis.zip" | |
}, | |
"FunctionName": "sample-service-dev-DataAnalysis", | |
"Handler": "data_analysis.handler", | |
"MemorySize": 128, | |
"Role": { | |
"Fn::GetAtt": [ | |
"IamRoleLambdaExecution", | |
"Arn" | |
] | |
}, | |
"Runtime": "python3.6", | |
"Timeout": 5, | |
"Layers": [ | |
"arn:aws:lambda:ap-southeast-1:468957933125:layer:AWSLambda-Python36-SciPy1x:2", | |
{ | |
"Ref": "PandasLambdaLayer" | |
} | |
] | |
}, | |
"DependsOn": [ | |
"DataAnalysisLogGroup", | |
"IamRoleLambdaExecution" | |
] | |
}, | |
"DataAnalysisLambdaVersionm3mFvLag66oGAZAtLUXOC5KjOOK7Tmzmtz467xwx8": { | |
"Type": "AWS::Lambda::Version", | |
"DeletionPolicy": "Retain", | |
"Properties": { | |
"FunctionName": { | |
"Ref": "DataAnalysisLambdaFunction" | |
}, | |
"CodeSha256": "Sw360W0H7uwkMHu0RyvWpmni0fwXCQ00Xl0s/rFFK80=" | |
} | |
} | |
}, | |
"Outputs": { | |
"ServerlessDeploymentBucketName": { | |
"Value": { | |
"Ref": "ServerlessDeploymentBucket" | |
} | |
}, | |
"PandasLambdaLayerQualifiedArn": { | |
"Description": "Current Lambda layer version", | |
"Value": { | |
"Ref": "PandasLambdaLayer" | |
} | |
}, | |
"DataAnalysisLambdaFunctionQualifiedArn": { | |
"Description": "Current Lambda function version", | |
"Value": { | |
"Ref": "DataAnalysisLambdaVersionm3mFvLag66oGAZAtLUXOC5KjOOK7Tmzmtz467xwx8" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment