Created
July 20, 2019 19:24
-
-
Save alangixxer/f1cc07a51d121fb90c9e4c479f37748f to your computer and use it in GitHub Desktop.
QLDB-Account-Activity-cf-template.json
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", | |
"Parameters":{ | |
"JavaFunctionName":{ | |
"Type":"String", | |
"Default":"QLDB-java-function", | |
"Description":"Enter name for the java lambda function." | |
}, | |
"PythonFunctionName":{ | |
"Type":"String", | |
"Default":"QLDB-python-function", | |
"Description":"Enter name for the python lambda function." | |
}, | |
"QLDBLedgerName":{ | |
"Type":"String", | |
"Default":"S3Bucket", | |
"Description":"Enter name for the QLDB Ledger Name." | |
}, | |
"QLDBTableName":{ | |
"Type":"String", | |
"Default":"s3tracker", | |
"Description":"Enter name for the QLDB Table Name." | |
} | |
}, | |
"Resources":{ | |
"PythonLambda":{ | |
"Type":"AWS::Lambda::Function", | |
"Properties":{ | |
"FunctionName":{ | |
"Ref":"PythonFunctionName" | |
}, | |
"Handler":"lambda_function.lambda_handler", | |
"Role":{ | |
"Fn::GetAtt":[ | |
"PythonLambdaRole", | |
"Arn" | |
] | |
}, | |
"Code":{ | |
"S3Bucket":"test-s3-bucket-for-lambda", | |
"S3Key":"QLDB-python-lambda.zip" | |
}, | |
"Runtime":"python3.7", | |
"Timeout":120, | |
"MemorySize":1000, | |
"Environment":{ | |
"Variables":{ | |
"JAVA_LAMBDA_NAME":{ | |
"Ref":"JavaFunctionName" | |
}, | |
"LEDGER_NAME":{ | |
"Ref":"QLDBLedgerName" | |
}, | |
"TABLE_NAME":{ | |
"Ref":"QLDBTableName" | |
} | |
} | |
} | |
} | |
}, | |
"JavaLambda":{ | |
"Type":"AWS::Lambda::Function", | |
"Properties":{ | |
"FunctionName":{ | |
"Ref":"JavaFunctionName" | |
}, | |
"Handler":"software.amazon.qldb.tutorial.TestHandler", | |
"Role":{ | |
"Fn::GetAtt":[ | |
"JavaLambdaRole", | |
"Arn" | |
] | |
}, | |
"Code":{ | |
"S3Bucket":"qldb-20190701-lambda-function", | |
"S3Key":"qldb-tutorial-0.1.0-beta.zip" | |
}, | |
"Runtime":"java8", | |
"Timeout":120, | |
"MemorySize":1000 | |
} | |
}, | |
"PythonLambdaRole":{ | |
"Type":"AWS::IAM::Role", | |
"Properties":{ | |
"RoleName":"PythonLambdaRole", | |
"AssumeRolePolicyDocument":{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Effect":"Allow", | |
"Principal":{ | |
"Service":[ | |
"lambda.amazonaws.com" | |
] | |
}, | |
"Action":[ | |
"sts:AssumeRole" | |
] | |
} | |
] | |
}, | |
"Path":"/", | |
"Policies":[ | |
{ | |
"PolicyName":"AWSLambdaBasicExecutionRole", | |
"PolicyDocument":{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Effect":"Allow", | |
"Action":[ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents" | |
], | |
"Resource":"*" | |
} | |
] | |
} | |
}, | |
{ | |
"PolicyName":"AmazonFullAccess", | |
"PolicyDocument":{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Effect":"Allow", | |
"Action":"*", | |
"Resource":"*" | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
"JavaLambdaRole":{ | |
"Type":"AWS::IAM::Role", | |
"Properties":{ | |
"RoleName":"JavaLambdaRole", | |
"AssumeRolePolicyDocument":{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Effect":"Allow", | |
"Principal":{ | |
"Service":[ | |
"lambda.amazonaws.com" | |
] | |
}, | |
"Action":[ | |
"sts:AssumeRole" | |
] | |
} | |
] | |
}, | |
"Path":"/", | |
"Policies":[ | |
{ | |
"PolicyName":"AWSLambdaBasicExecutionRole", | |
"PolicyDocument":{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Effect":"Allow", | |
"Action":[ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents" | |
], | |
"Resource":"*" | |
} | |
] | |
} | |
}, | |
{ | |
"PolicyName":"AmazonFullAccess", | |
"PolicyDocument":{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Effect":"Allow", | |
"Action":"*", | |
"Resource":"*" | |
} | |
] | |
} | |
} | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment