Skip to content

Instantly share code, notes, and snippets.

@waynerobinson
Created April 19, 2019 22:36
Show Gist options
  • Save waynerobinson/5dbe9860fde41c41f4a48cc68eab0883 to your computer and use it in GitHub Desktop.
Save waynerobinson/5dbe9860fde41c41f4a48cc68eab0883 to your computer and use it in GitHub Desktop.
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