Skip to content

Instantly share code, notes, and snippets.

@brysontyrrell
Created November 25, 2020 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brysontyrrell/cf96bf674924d2aab31611fb8d6bc59c to your computer and use it in GitHub Desktop.
Save brysontyrrell/cf96bf674924d2aab31611fb8d6bc59c to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
HttpApi:
Type: AWS::Serverless::HttpApi
Properties:
StageName: prod
DefinitionBody:
openapi: "3.0.1"
paths:
/:
post:
x-amazon-apigateway-integration:
integrationSubtype: StepFunctions-StartSyncExecution
credentials: !GetAtt HttpApiRole.Arn
requestParameters:
Input: "$request.body"
StateMachineArn: !Sub arn:${AWS::Partition}:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${AWS::StackName}-Stepception
payloadFormatVersion: 1.0
type: aws_proxy
connectionType: INTERNET
HttpApiRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- apigateway.amazonaws.com
- states.amazonaws.com
Action:
- sts:AssumeRole
Policies:
- PolicyName: AllowSFNExec
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action: states:StartSyncExecution
Resource: !Sub arn:${AWS::Partition}:states:${AWS::Region}:${AWS::AccountId}:stateMachine:${AWS::StackName}-Stepception
StepceptionStateMachine:
Type: AWS::Serverless::StateMachine
Properties:
Name: !Sub ${AWS::StackName}-Stepception
Type: EXPRESS
Role: !GetAtt HttpApiRole.Arn
Definition:
StartAt: Stepception
States:
Stepception:
Type: Task
Resource: arn:aws:states:::apigateway:invoke
Parameters:
ApiEndpoint: !Sub ${HttpApi}.execute-api.${AWS::Region}.amazonaws.com
Method: POST
Stage: prod
Path: /
AuthType: NO_AUTH
End: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment