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개 답변
2
수락된 답변

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
hayao-k
답변함 2년 전
profile picture
전문가
검토됨 한 달 전
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 pictureAWS
전문가
Uri
답변함 2년 전
  • 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?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠