Skip to content

Instantly share code, notes, and snippets.

@Kalki5
Created February 18, 2018 13:51
Show Gist options
  • Save Kalki5/dcddac78bb46b5e15f650306421d10ad to your computer and use it in GitHub Desktop.
Save Kalki5/dcddac78bb46b5e15f650306421d10ad to your computer and use it in GitHub Desktop.
import boto3
import json
lambda_client = boto3.client(
service_name='lambda',
region_name='us-east-2',
aws_access_key_id='ACCESS_KEY',
aws_secret_access_key='SECRET_KEY'
)
response = lambda_client.invoke(
FunctionName='HelloWorld',
InvocationType='RequestResponse',
LogType='None',
Payload=b'{"name": "'+'World'+'"}'
)
sf_client = boto3.client(
service_name='stepfunctions',
region_name='us-east-2',
aws_access_key_id='ACCESS_KEY',
aws_secret_access_key='SECRET_KEY'
)
response = sf_client.start_execution(
stateMachineArn='arn:aws:states:us-east-2:ACCOUNT_NUMBER:stateMachine:HelloWorldSM',
input='{"name":"Despicable Me"}'
)
response1 = sf_client.describe_execution(
executionArn=response['executionArn'],
)
print json.dumps(response1, indent=4, sort_keys=True, default=str)
response2 = sf_client.get_execution_history(
executionArn=response['executionArn'],
)
print json.dumps(response2, indent=4, sort_keys=True, default=str)
activity_poll = sf_client.get_activity_task(
activityArn='arn:aws:states:us-east-2:ACCOUNT_NUMBER:activity:add-greeting'
)
activity_output = sf_client.send_task_success(
taskToken=activity_poll['taskToken'],
output=activity_poll['input']+', Good Night'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment