Created
April 19, 2019 22:36
-
-
Save waynerobinson/5dbe9860fde41c41f4a48cc68eab0883 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
import boto3 | |
import os | |
def lambda_handler(event, context): | |
print(event['queryStringParameters']) | |
client = boto3.client('stepfunctions') | |
country = event['queryStringParameters']['Country'] | |
exec_response = client.start_execution( | |
stateMachineArn=os.environ.get('stepfunctions_arn'), | |
#name='string', | |
input="{\"Country\" : \""+country+"\" }" | |
) | |
#capture executionArn | |
executionArn = exec_response['executionArn'] | |
#get activity task | |
activity_response = client.get_activity_task( | |
activityArn=os.environ.get("worker_arn"), | |
workerName=os.environ.get("stepfunctions_arn") | |
) | |
task_token = activity_response['taskToken'] | |
print(task_token) | |
body = '{ "task_token" :"'+ task_token + '", "executionArn":"'+executionArn+'"}' | |
print(body) | |
return { | |
'statusCode': 200, | |
'body': body, | |
'headers':{ | |
"Access-Control-Allow-Origin":"*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment