Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

328
Views
Is there a way of running AWS Step Functions locally when defined by CDK?

AWS Step Functions may be run in a local Docker environment using Step Functions Local Docker. However, the step functions need to be defined using the JSON-based Amazon States Language. This is not at all convenient if your AWS infrastructure (Step Functions plus lambdas) is defined using AWS CDK/CloudFormation.

Is there a way to create the Amazon States Language definition of a state machine from the CDK or CloudFormation output, such that it’s possible to run the step functions locally?

My development cycle is currently taking me 30 minutes to build/deploy/run my Lambda-based step functions in AWS in order to test them and there must surely be a better/faster way of testing them than this.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You can use cdk watch or the --hotswap option to deploy your updated state machine or Lambda functions without a CloudFormation deployment.

https://aws.amazon.com/blogs/developer/increasing-development-speed-with-cdk-watch/

If you want to test with Step Functions local, cdk synth generates the CloudFormation code containing the state machine's ASL JSON definition. If you get that and replace the CloudFormation references and intrinsic functions, you can use it to create and execute the state machine in Step Functions Local.

How some people have automated this:

  • https://nathanagez.com/blog/mocking-service-integration-step-functions-local-cdk/
  • https://github.com/kenfdev/step-functions-testing
over 4 years ago · Santiago Trujillo Report

0

We have been able to achieve this by the following:

Download:

https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local.html

To run step functions local, in the directory where you extracted the local Step Function files run:

java -jar StepFunctionsLocal.jar --lambda-endpoint http://localhost:3003

To create a state machine, you need a json definition (It can be pulled from the generated template or can get the toolkit plug in for Vs code, type step functions, select from a template and that can be your starter. Can also get it from the AWS console in the definition tab on the step function.

Run this command in the same directory as the definition json:

aws stepfunctions --endpoint http://localhost:8083 create-state-machine --definition "cat step-function.json" --name "local-state-machine" --role-arn "arn:aws:iam::012345678901:role/DummyRole"

You should be able to hit the SF now (hopefully) :)

over 4 years ago · Santiago Trujillo Report

0

Another solution that might help is to use localstack what is supports many tools such CDK or CloudFormation and let developers to run stack locally.

There are a variety ways to run it, one of them is to run it manually in docker container, according to the instruction get started.

Next following the instruction what's next configure aws-cli or use awslocal.

All next steps and templates should be the same as for AWS API in the cloud.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!