Created
August 25, 2019 00:57
-
-
Save anhtv08/9e0316b932e29d407f047ef2649bb8fd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
Transform: 'AWS::Serverless-2016-10-31' | |
#Parameters: | |
# LambdaExecutionRole: | |
Resources: | |
ruleEvaluationDev: | |
Type: 'AWS::Serverless::Function' | |
Properties: | |
FunctionName: 'cost-controller-function' | |
Description: 'Integrating lambda with Parameter Store' | |
Handler: 'cost_controller.cost_controller_handlers.lambda_handler' | |
Runtime: 'python3.6' | |
Role: 'arn:aws:iam::674028589551:role/service-role/my-rule-evaluation-function' | |
Timeout: 5 | |
Tracing: 'Active' | |
userManagement: | |
Type: 'AWS::Serverless::Function' | |
Properties: | |
FunctionName: 'user-management' | |
Description: 'user management function' | |
Handler: 'dynamo.DynamoServices.lambda_handler' | |
Runtime: 'python3.6' | |
Role: 'arn:aws:iam::674028589551:role/service-role/my-rule-evaluation-function' | |
Timeout: 5 | |
Tracing: 'Active' | |
EventRule: | |
Type: AWS::Events::Rule | |
Properties: | |
Description: "evaluate ec2 instance state changes" | |
Name: "ec2-resource-evaluation-rule" | |
EventPattern: | |
source: | |
- "aws.ec2" | |
detail-type: | |
- "EC2 Instance State-change Notification" | |
State: "ENABLED" | |
Targets: | |
- Arn: | |
Fn::GetAtt: | |
- "ruleEvaluationDev" | |
- "Arn" | |
Id: "TargetFunctionV1" | |
PermissionForEventsToInvokeLambda: | |
Type: AWS::Lambda::Permission | |
Properties: | |
FunctionName: | |
Ref: "ruleEvaluationDev" | |
Action: "lambda:InvokeFunction" | |
Principal: "events.amazonaws.com" | |
SourceArn: | |
Fn::GetAtt: | |
- "EventRule" | |
- "Arn" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment