Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting AWS State machine execution ARN inside the step function

I need to get the ARN of the current execution for my state machine inside the state machine itself. Is it possible?

So can I create a state machine(say from a lambda function) and then take its execution ARN and pass it as a parameter to that machine OR is there any utility available inside the state machine that allows getting the execution ARN for that machine?

like image 918
Farhan Haider Avatar asked Apr 17 '19 13:04

Farhan Haider


People also ask

Is AWS Step Functions a state machine?

Step Functions is based on state machines and tasks. A state machine is a workflow. A task is a state in a workflow that represents a single unit of work that another AWS service performs. Each step in a workflow is a state.

What is $$ in Step Functions?

$ to the end, as you do when selecting state input with a path. Then, to access context object data instead of the input, prepend the path with $$. . This tells AWS Step Functions to use the path to select a node in the context object.

Can AWS API gateway call STEP function?

Amazon API Gateway now integrates with AWS Step Functions, allowing you to call Step Functions with APIs that you create to simplify and customize interfaces to your applications.

What is execution Arn?

executionArn. The Amazon Resource Name (ARN) that identifies the execution. Type: String. Length Constraints: Minimum length of 1. Maximum length of 256.


2 Answers

AWS Step Functions released recently a feature called context object.

Now you have access to the execution data through $$ inside the Parameters block.

https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html

like image 122
diegosantiviago Avatar answered Sep 20 '22 18:09

diegosantiviago


Step Functions do not currently have this feature, you can however specify your own execution id by specifying a name. This will make the ARN predictable, as it will end up being

arn:aws:states:[AWS Region]:[AWS Account ID]:execution:[Step Function Name]:[The name that you passed to the start-execution call]

javascript sdk docs

like image 26
mtstrong17 Avatar answered Sep 22 '22 18:09

mtstrong17