Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "AWSTemplateFormatVersion": "2010-09-09",
- "Description": "The AWS CloudFormation template for this Serverless application",
- "Resources": {
- "ServerlessDeploymentBucket": {
- "Type": "AWS::S3::Bucket",
- "Properties": {
- "BucketEncryption": {
- "ServerSideEncryptionConfiguration": [
- {
- "ServerSideEncryptionByDefault": {
- "SSEAlgorithm": "AES256"
- }
- }
- ]
- }
- }
- },
- "LambdaLogGroup": {
- "Type": "AWS::Logs::LogGroup",
- "Properties": {
- "LogGroupName": "/aws/lambda/meteosuper-forecast-text-dev-lambda"
- }
- },
- "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",
- "meteosuper-forecast-text",
- "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/meteosuper-forecast-text-dev*:*"
- }
- ]
- },
- {
- "Effect": "Allow",
- "Action": [
- "logs:PutLogEvents"
- ],
- "Resource": [
- {
- "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/meteosuper-forecast-text-dev*:*:*"
- }
- ]
- },
- {
- "Effect": "Allow",
- "Action": [
- "dynamodb:*"
- ],
- "Resource": "*"
- },
- {
- "Effect": "Allow",
- "Action": [
- "iam:*"
- ],
- "Resource": "*"
- },
- {
- "Effect": "Allow",
- "Action": [
- "lambda:*"
- ],
- "Resource": "*"
- },
- {
- "Effect": "Allow",
- "Action": [
- "s3:*"
- ],
- "Resource": "*"
- }
- ]
- }
- }
- ],
- "Path": "/",
- "RoleName": {
- "Fn::Join": [
- "-",
- [
- "meteosuper-forecast-text",
- "dev",
- {
- "Ref": "AWS::Region"
- },
- "lambdaRole"
- ]
- ]
- }
- }
- },
- "LambdaLambdaFunction": {
- "Type": "AWS::Lambda::Function",
- "Properties": {
- "Code": {
- "S3Bucket": {
- "Ref": "ServerlessDeploymentBucket"
- },
- "S3Key": "serverless/meteosuper-forecast-text/dev/1569421132342-2019-09-25T14:18:52.342Z/meteosuper-forecast-text.zip"
- },
- "FunctionName": "meteosuper-forecast-text-dev-lambda",
- "Handler": "src/handler.handler",
- "MemorySize": 512,
- "Role": {
- "Fn::GetAtt": [
- "IamRoleLambdaExecution",
- "Arn"
- ]
- },
- "Runtime": "nodejs10.x",
- "Timeout": 180,
- "Description": "Get forecasts text from S3 and write them in DB",
- "Tags": [
- {
- "Key": "LAMBDA",
- "Value": "meteosuper-forecast-text-dev-lambda"
- }
- ],
- "Environment": {
- "Variables": {
- "STAGE": "dev"
- }
- }
- },
- "DependsOn": [
- "LambdaLogGroup",
- "IamRoleLambdaExecution"
- ]
- },
- "LambdaLambdaVersionIFDrlkyZQJ3IzN2ZVe9XawQdazjXWMobUXy1wUUDGE": {
- "Type": "AWS::Lambda::Version",
- "DeletionPolicy": "Retain",
- "Properties": {
- "FunctionName": {
- "Ref": "LambdaLambdaFunction"
- },
- "CodeSha256": "v9ZxC3nhstn8Ia+FRKVPbEZvfDG3Yy/WEfFfh41pn10=",
- "Description": "Get forecasts text from S3 and write them in DB"
- }
- },
- "LambdaCustomS31": {
- "Type": "Custom::S3",
- "Version": 1,
- "DependsOn": [
- "LambdaLambdaFunction",
- "CustomDashresourceDashexistingDashs3LambdaFunction"
- ],
- "Properties": {
- "ServiceToken": {
- "Fn::GetAtt": [
- "CustomDashresourceDashexistingDashs3LambdaFunction",
- "Arn"
- ]
- },
- "FunctionName": "meteosuper-forecast-text-dev-lambda",
- "BucketName": "meteo-forecasts-raw-dev",
- "BucketConfigs": [
- {
- "Event": "s3:ObjectCreated:*",
- "Rules": [
- {
- "Prefix": "xml-texts/"
- },
- {
- "Suffix": ".xml"
- }
- ]
- }
- ]
- }
- },
- "CustomDashresourceDashexistingDashs3LambdaFunction": {
- "Type": "AWS::Lambda::Function",
- "Properties": {
- "Code": {
- "S3Bucket": {
- "Ref": "ServerlessDeploymentBucket"
- },
- "S3Key": "serverless/meteosuper-forecast-text/dev/1569421132342-2019-09-25T14:18:52.342Z/custom-resources.zip"
- },
- "FunctionName": "meteosuper-forecast-text-dev-custom-resource-existing-s3",
- "Handler": "s3/handler.handler",
- "MemorySize": 1024,
- "Role": {
- "Fn::GetAtt": [
- "IamRoleCustomResourcesLambdaExecution",
- "Arn"
- ]
- },
- "Runtime": "nodejs10.x",
- "Timeout": 180
- },
- "DependsOn": [
- "IamRoleCustomResourcesLambdaExecution"
- ]
- },
- "IamRoleCustomResourcesLambdaExecution": {
- "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",
- "meteosuper-forecast-text",
- "custom-resources-lambda"
- ]
- ]
- },
- "PolicyDocument": {
- "Version": "2012-10-17",
- "Statement": [
- {
- "Effect": "Allow",
- "Resource": {
- "Fn::Join": [
- ":",
- [
- "arn",
- {
- "Ref": "AWS::Partition"
- },
- "s3",
- "",
- "",
- "meteo-forecasts-raw-dev"
- ]
- ]
- },
- "Action": [
- "s3:PutBucketNotification",
- "s3:GetBucketNotification"
- ]
- },
- {
- "Effect": "Allow",
- "Resource": {
- "Fn::Join": [
- ":",
- [
- "arn",
- {
- "Ref": "AWS::Partition"
- },
- "lambda",
- {
- "Ref": "AWS::Region"
- },
- {
- "Ref": "AWS::AccountId"
- },
- "function",
- "meteosuper-forecast-text-dev-lambda"
- ]
- ]
- },
- "Action": [
- "lambda:AddPermission",
- "lambda:RemovePermission"
- ]
- }
- ]
- }
- }
- ]
- }
- }
- },
- "Outputs": {
- "ServerlessDeploymentBucketName": {
- "Value": {
- "Ref": "ServerlessDeploymentBucket"
- }
- },
- "LambdaLambdaFunctionQualifiedArn": {
- "Description": "Current Lambda function version",
- "Value": {
- "Ref": "LambdaLambdaVersionIFDrlkyZQJ3IzN2ZVe9XawQdazjXWMobUXy1wUUDGE"
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement