79 lines
No EOL
2.3 KiB
Text
79 lines
No EOL
2.3 KiB
Text
{
|
|
"AWSTemplateFormatVersion": "2010-09-09",
|
|
"Resources": {
|
|
"DynamoDBPutItemsFunctionRole": {
|
|
"Type": "AWS::IAM::Role",
|
|
"Properties": {
|
|
"AssumeRolePolicyDocument": {
|
|
"Version" : "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Effect": "Allow",
|
|
"Principal": {
|
|
"Service": [ "lambda.amazonaws.com" ]
|
|
},
|
|
"Action": [ "sts:AssumeRole" ]
|
|
}
|
|
]
|
|
},
|
|
"Policies": [
|
|
{
|
|
"PolicyName": "LogWriter",
|
|
"PolicyDocument": {
|
|
"Version" : "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Effect": "Allow",
|
|
"Action": [
|
|
"logs:CreateLogGroup",
|
|
"logs:CreateLogStream",
|
|
"logs:PutLogEvents"
|
|
],
|
|
"Resource": "arn:aws:logs:*:*:*"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"PolicyName": "DBWriter",
|
|
"PolicyDocument": {
|
|
"Version" : "2012-10-17",
|
|
"Statement": [
|
|
{
|
|
"Effect": "Allow",
|
|
"Action": [
|
|
"dynamodb:PutItem"
|
|
],
|
|
"Resource": { "Fn::Join": [ "", [ "arn:aws:dynamodb:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" } , ":table/*" ] ] }
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"DynamoDBPutItemsFunction": {
|
|
"Type": "AWS::Lambda::Function",
|
|
"Properties": {
|
|
"Code": {
|
|
"S3Bucket": "com.gilt.public.backoffice",
|
|
"S3Key": "lambda_functions/cloudformation-helpers.zip"
|
|
},
|
|
"Description": "Used to populate a DynamoDB database from CloudFormation",
|
|
"Handler": "cloudformation_helpers.dynamoDBPutItems",
|
|
"Role": {"Fn::GetAtt" : [ "DynamoDBPutItemsFunctionRole", "Arn" ] },
|
|
"Runtime": "nodejs",
|
|
"Timeout": 30
|
|
},
|
|
"DependsOn": [
|
|
"DynamoDBPutItemsFunctionRole"
|
|
]
|
|
}
|
|
},
|
|
"Outputs": {
|
|
"DynamoDBPutItemsFunctionArn": {
|
|
"Description": "The ARN of the DynamoDBPutItemsFunction, for use in other CloudFormation templates.",
|
|
"Value": { "Fn::GetAtt" : ["DynamoDBPutItemsFunction", "Arn"] }
|
|
}
|
|
}
|
|
} |