Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save horike37/1acffa7822045a1f29490e0d6734b13d to your computer and use it in GitHub Desktop.
Save horike37/1acffa7822045a1f29490e0d6734b13d to your computer and use it in GitHub Desktop.
{
"APIAssumeRolePolicyDocument": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "apigateway.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
},
"Policies": [
{
"PolicyName": "apigatewaytostepfunctions",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"states:StartExecution"
],
"Resource": "*"
}
]
}
}
]
}
},
"ApiGatewayRestApi": {
"Type": "AWS::ApiGateway::RestApi",
"Properties": {
"Name": "dev-step-function"
}
},
"ApiGatewayResourcePanpan": {
"Type": "AWS::ApiGateway::Resource",
"Properties": {
"ParentId": {
"Fn::GetAtt": [
"ApiGatewayRestApi",
"RootResourceId"
]
},
"PathPart": "panpan",
"RestApiId": {
"Ref": "ApiGatewayRestApi"
}
}
},
"ApiGatewayMethodPanpanGet": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "POST",
"RequestParameters": {},
"ResourceId": {
"Ref": "ApiGatewayResourcePanpan"
},
"RestApiId": {
"Ref": "ApiGatewayRestApi"
},
"AuthorizationType": "NONE",
"Integration": {
"IntegrationHttpMethod": "POST",
"Type": "AWS",
"Credentials": {
"Fn::GetAtt" : [
"APIAssumeRolePolicyDocument",
"Arn"
]
},
"Uri": {
"Fn::Join": [
"",
[
"arn:aws:apigateway:",
{
"Ref": "AWS::Region"
},
":states:action/StartExecution"
]
]
},
"PassthroughBehavior": "NEVER",
"RequestTemplates": {
"application/json": {
"Fn::Join" : [
"", [
"#set( $body = $util.escapeJavaScript($input.json('$')) ) \n\n{\"input\": \"$body\",\"name\": \"$context.requestId\",\"stateMachineArn\":\"",
{
"Ref": "MyStateMachine1StepFunctionsStateMachine"
},
"\"}"
]
]
}
},
"IntegrationResponses": [
{
"StatusCode": 200,
"SelectionPattern": "",
"ResponseParameters": {},
"ResponseTemplates": {}
},
{
"StatusCode": 400,
"SelectionPattern": "[\\s\\S]*\\[400\\][\\s\\S]*",
"ResponseParameters": {},
"ResponseTemplates": {}
}
]
},
"MethodResponses": [
{
"ResponseParameters": {},
"ResponseModels": {},
"StatusCode": 200
},
{
"ResponseParameters": {},
"ResponseModels": {},
"StatusCode": 400
}
]
}
},
"ApiGatewayDeployment14917816s7ff278": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
"Ref": "ApiGatewayRestApi"
},
"StageName": "dev"
},
"DependsOn": [
"ApiGatewayMethodPanpanGet"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment