By using AWS re:Post, you agree to the Terms of Use

Step Functions Local with Boto3

0

Hello,

I am working with AWS Step Functions and we are exploring the testing options. AWS Step Functions local seems like the way to go. I have tested it out locally as outlined in this guide, which works well. That requires using the AWS CLI to interact with SFN local. We are a Python shop so being able to continue using boto3 for interactions with AWS would be great. Is there anyway to use boto3 to query the local SFNs? I haven't seen any documentation about this and I've tried but the latest boto3 (1.24.71) doesn't seem to know about endpoints.

Thanks

2 Answers
1
Accepted Answer

Hi,

I believe you can specify the endpoints as follows

import boto3

client = boto3.client('stepfunctions', endpoint_url='http://localhost:8083')

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

profile picture
answered 24 days ago
0

I don't think there is a way and I must say that I do not understand why you need it. We are talking about testing the state machine. So all you need to do is create the input JSON and invoke it locally. You are not running integration tests locally which require some other service to invoke the state machine.

profile picture
EXPERT
answered 24 days ago
  • The thought around using Python is that we already use it for our automated testing framework and it would be nice to not have to introduce another paradigm. With boto3 support we could start Step Functions Local and then ,in Python, provide the input to the local state machine and then inspect the output to ensure it conforms to our expectations. If anything goes wrong we could use the standard errors and patterns our team is already familiar with to signify a failed test. This can certainly occur by calling out to the AWS CLI from Python but that is less than ideal.

    If this still doesn't fit a pattern that makes sense to you could you outline how you would go about structuring automated testing of Step Functions?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions