Created
April 2, 2023 10:16
-
-
Save mshakhomirov/067e4cc5a2bf12708884a700c9191690 to your computer and use it in GitHub Desktop.
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
# simple_stack.yaml | |
# AWS Cloudformation example for data pipeline | |
AWSTemplateFormatVersion: '2010-09-09' | |
Description: An example template for a Step Functions state machine. | |
Resources: | |
LambdaExecutionRole: | |
Type: "AWS::IAM::Role" | |
Properties: | |
AssumeRolePolicyDocument: | |
Version: "2012-10-17" | |
Statement: | |
- Effect: Allow | |
Principal: | |
Service: lambda.amazonaws.com | |
Action: "sts:AssumeRole" | |
MyLambdaFunction: | |
Type: "AWS::Lambda::Function" | |
Properties: | |
Handler: "index.handler" | |
Role: !GetAtt [ LambdaExecutionRole, Arn ] | |
Code: | |
ZipFile: | | |
exports.handler = (event, context, callback) => { | |
callback(null, "Hello World!"); | |
}; | |
Runtime: "nodejs12.x" | |
Timeout: "25" | |
StatesExecutionRole: | |
Type: "AWS::IAM::Role" | |
Properties: | |
AssumeRolePolicyDocument: | |
Version: "2012-10-17" | |
Statement: | |
- Effect: "Allow" | |
Principal: | |
Service: | |
- !Sub states.${AWS::Region}.amazonaws.com | |
Action: "sts:AssumeRole" | |
Path: "/" | |
Policies: | |
- PolicyName: StatesExecutionPolicy | |
PolicyDocument: | |
Version: "2012-10-17" | |
Statement: | |
- Effect: Allow | |
Action: | |
- "lambda:InvokeFunction" | |
Resource: "*" | |
MyStateMachine: | |
Type: AWS::StepFunctions::StateMachine | |
Properties: | |
StateMachineName: HelloWorld-StateMachine | |
DefinitionString: | |
!Sub | |
- |- | |
{ | |
"Comment": "A Hello World example using an AWS Lambda function", | |
"StartAt": "HelloWorld", | |
"States": { | |
"HelloWorld": { | |
"Type": "Task", | |
"Resource": "${lambdaArn}", | |
"End": true | |
} | |
} | |
} | |
- {lambdaArn: !GetAtt [ MyLambdaFunction, Arn ]} | |
RoleArn: !GetAtt [ StatesExecutionRole, Arn ] | |
Tags: | |
- | |
Key: "keyname1" | |
Value: "value1" | |
- | |
Key: "keyname2" | |
Value: "value2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment