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

287
Views
Invoking aws Step function from java lambda

I have created a step function in aws. Name of my state machine is 'TestStep'. which is used to iterate a number from 1 to 1000.

I have created an IAM Role which has "AWSStepFunctionsFullAccess" policy.

I created one java lambda to access this step function. My code is given below.

 final StateMachine stateMachine = stateMachine().comment("Iterator State Machine Example").startAt("ConfigureCount")
             .state("ConfigureCount", taskState()
               .resource("arn:aws:lambda:us-east-1:ACCOUNTID:function:TestStep")
               .transition(end()))
       .build();
final AWSStepFunctions client = AWSStepFunctionsClientBuilder.defaultClient();
        client.createStateMachine(new CreateStateMachineRequest()
                                                  .withName("TestStep")
                                                  .withRoleArn("arn:aws:iam::ACCOUNTID:role/ROLENAME")
                                                  .withDefinition(stateMachine));

But I am getting an error like below. Please help me to get this correctly. When i am calling it from java the step function should be triggered and work...

enter image description here

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Happy to inform you that I found the solution. The above code I mentioned is for creating a new state machine and trying to run the newly created state machine from java lambda. For my scenario that is just call a step function which is already created in aws step function please follow the below steps.

First, add dependency in pom.xml

<dependency>
   <groupId>com.amazonaws</groupId>
   <artifactId>aws-java-sdk-stepfunctions</artifactId>
   <version>1.11.285</version>

then use the below code to call a step function from your java

  awsStepfunctionClient.startExecution(StartExecutionRequest);
over 4 years ago · Santiago Trujillo Report

0

For the AWS Java SDK v2, the dependency for the pom is:

<dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>sfn</artifactId>
    <version>2.16.59</version>
<dependency>

Then use the standard builder pattern for the client (and StartExecutionRequest object) to trigger your execution:

SfnClient sfc = SfnClient.builder()
        .region()
        .build();

sfc.startExecution(startExecutionRequest);
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!