{ "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" } } ] } } }, "ServerlessDeploymentBucketPolicy": { "Type": "AWS::S3::BucketPolicy", "Properties": { "Bucket": { "Ref": "ServerlessDeploymentBucket" }, "PolicyDocument": { "Statement": [ { "Action": "s3:*", "Effect": "Deny", "Principal": "*", "Resource": [ { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":s3:::", { "Ref": "ServerlessDeploymentBucket" }, "/*" ] ] }, { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":s3:::", { "Ref": "ServerlessDeploymentBucket" } ] ] } ], "Condition": { "Bool": { "aws:SecureTransport": false } } } ] } } }, "PrepDashfLogGroup": { "Type": "AWS::Logs::LogGroup", "Properties": { "LogGroupName": "/aws/lambda/hdci-wallpad-raw-to-prep" } }, "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": [ "-", [ "hnw-wallpad-etl", "dev", "lambda" ] ] }, "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogStream", "logs:CreateLogGroup" ], "Resource": [ { "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/hdci-wallpad-raw-to-prep:*" } ] }, { "Effect": "Allow", "Action": [ "logs:PutLogEvents" ], "Resource": [ { "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/hdci-wallpad-raw-to-prep:*:*" } ] }, { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject" ], "Resource": "arn:aws:s3:::homenetwork-data/*" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::hdci-wallpad-prep/*" } ] } } ], "Path": "/", "RoleName": { "Fn::Join": [ "-", [ "hnw-wallpad-etl", "dev", { "Ref": "AWS::Region" }, "lambdaRole" ] ] } } }, "PrepDashfLambdaFunction": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { "S3Bucket": { "Ref": "ServerlessDeploymentBucket" }, "S3Key": "serverless/hnw-wallpad-etl/dev/1617779857545-2021-04-07T07:17:37.545Z/preprocess-hdci-wallpad-raw-to-prep.zip" }, "Handler": "preprocess/lambda_function.lambda_handler", "Runtime": "python3.8", "FunctionName": "hdci-wallpad-raw-to-prep", "MemorySize": 1024, "Timeout": 180, "Environment": { "Variables": { "PREP_BUCKET": "hdci-wallpad-prep" } }, "Role": { "Fn::GetAtt": [ "IamRoleLambdaExecution", "Arn" ] } }, "DependsOn": [ "PrepDashfLogGroup" ] }, "PrepDashfLambdaVersion6kG0JfRlaV9PcfPIfqXoZs7UXmFownZER3v6tOps6iY": { "Type": "AWS::Lambda::Version", "DeletionPolicy": "Retain", "Properties": { "FunctionName": { "Ref": "PrepDashfLambdaFunction" }, "CodeSha256": "pzZFpQxx/iOmdihZHN62crmDKmGlSChnGjtFpayNX28=" } }, "PrepDashfCustomS31": { "Type": "Custom::S3", "Version": 1, "DependsOn": [ "PrepDashfLambdaFunction", "CustomDashresourceDashexistingDashs3LambdaFunction" ], "Properties": { "ServiceToken": { "Fn::GetAtt": [ "CustomDashresourceDashexistingDashs3LambdaFunction", "Arn" ] }, "FunctionName": "hdci-wallpad-raw-to-prep", "BucketName": "homenetwork-data", "BucketConfigs": [ { "Event": "s3:ObjectCreated:*", "Rules": [] } ] } }, "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", "hnw-wallpad-etl", "custom-resources-lambda" ] ] }, "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Resource": { "Fn::Join": [ ":", [ "arn", { "Ref": "AWS::Partition" }, "s3", "", "", "homenetwork-data" ] ] }, "Action": [ "s3:PutBucketNotification", "s3:GetBucketNotification" ] }, { "Effect": "Allow", "Resource": { "Fn::Join": [ ":", [ "arn", { "Ref": "AWS::Partition" }, "lambda", { "Ref": "AWS::Region" }, { "Ref": "AWS::AccountId" }, "function", "*" ] ] }, "Action": [ "lambda:AddPermission", "lambda:RemovePermission" ] } ] } } ] } }, "CustomDashresourceDashexistingDashs3LambdaFunction": { "Type": "AWS::Lambda::Function", "Properties": { "Code": { "S3Bucket": { "Ref": "ServerlessDeploymentBucket" }, "S3Key": "serverless/hnw-wallpad-etl/dev/1617779857545-2021-04-07T07:17:37.545Z/custom-resources.zip" }, "FunctionName": "hnw-wallpad-etl-undefined-custom-resource-existing-s3", "Handler": "s3/handler.handler", "MemorySize": 1024, "Runtime": "nodejs12.x", "Timeout": 180, "Role": { "Fn::GetAtt": [ "IamRoleCustomResourcesLambdaExecution", "Arn" ] } }, "DependsOn": [ "IamRoleCustomResourcesLambdaExecution" ] } }, "Outputs": { "ServerlessDeploymentBucketName": { "Value": { "Ref": "ServerlessDeploymentBucket" } }, "PrepDashfLambdaFunctionQualifiedArn": { "Description": "Current Lambda function version", "Value": { "Ref": "PrepDashfLambdaVersion6kG0JfRlaV9PcfPIfqXoZs7UXmFownZER3v6tOps6iY" } } } }