Skip to content

Instantly share code, notes, and snippets.

@sudheerchamarthi
Created April 19, 2019 17:49
Show Gist options
  • Save sudheerchamarthi/1e9a5a26332f8533bff728493822df61 to your computer and use it in GitHub Desktop.
Save sudheerchamarthi/1e9a5a26332f8533bff728493822df61 to your computer and use it in GitHub Desktop.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"BucketPrefix": {
"Type": "String",
"Default": "test-bucket-name"
},
"LambdaFunctionName": {
"Type": "String",
"Default": "test-function-name"
}
},
"Resources": {
"LambdaInvokePermission": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"FunctionName": "es",
"Action": "lambda:InvokeFunction",
"Principal": "s3.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {
"Fn::Join": [
"",
[
"arn:aws:s3:::",
{
"Fn::Sub": "${BucketPrefix}-encryption-service"
}
]
]
}
}
},
"LambdaExecutionRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
},
"Path": "/",
"Policies": [
{
"PolicyName": "root",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:*"
],
"Resource": "arn:aws:logs:*:*:*"
}
]
}
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment