id
stringlengths 8
78
| source
stringclasses 743
values | chunk_id
int64 1
5.05k
| text
stringlengths 593
49.7k
|
---|---|---|---|
step-functions-dg-164
|
step-functions-dg.pdf
| 164 |
a batch in bytes, up to 256 KiB. If you specify both a maximum batch number and size, Step Functions reduces the number of items in a batch to avoid exceeding the specified batch size limit. Alternatively, you can specify the maximum batch size as a reference path to an existing key- value pair in your Distributed Map state input. This path must resolve to a positive integer. ItemBatcher 528 AWS Step Functions Note Developer Guide If you use batching and don't specify a maximum batch size, the interpreter processes as many items it can process up to 256 KiB in each child workflow execution. For example, given the following input: { "batchSize": 131072 } You can specify the maximum batch size using a reference path as follows: { ... "Map": { "Type": "Map", "MaxConcurrency": 2000, "ItemBatcher": { "MaxInputBytesPerBatchPath": "$.batchSize" } ... ... } } For JSONata-based states, you can also provide a JSONata expression that evaluates to a positive integer. Important You can specify either the MaxInputBytesPerBatch or the MaxInputBytesPerBatchPath (JSONPath only) sub-field, but not both. Batch input Optionally, you can also specify a fixed JSON input to include in each batch passed to each child workflow execution. Step Functions merges this input with the input for each individual child ItemBatcher 529 AWS Step Functions Developer Guide workflow executions. For example, given the following fixed input of a fact check date on an array of items: "ItemBatcher": { "BatchInput": { "factCheck": "December 2022" } } Each child workflow execution receives the following as input: { "BatchInput": { "factCheck": "December 2022" }, "Items": [ { "verdict": "true", "statement_date": "6/11/2008", "statement_source": "speech" }, { "verdict": "false", "statement_date": "6/7/2022", "statement_source": "television" }, ... ] } For JSONata-based states, you can provide JSONata expressions directly to BatchInput, or use JSONata expressions inside JSON objects or arrays. ResultWriter (Map) Managing state and transforming data Learn about Passing data between states with variables and Transforming data with JSONata. ResultWriter 530 AWS Step Functions Developer Guide The ResultWriter field is a JSON object that provides options for the output results of the child workflow executions started by a Distributed Map state. You can specify different formatting options for the output results along with the Amazon S3 location to store them if you choose to export them. Step Functions doesn't export these results by default. Contents • Contents of the ResultWriter field • Example configurations and transformation output • Exporting to Amazon S3 • IAM policies for ResultWriter Contents of the ResultWriter field The ResultWriter field contains the following sub-fields. The choice of fields determines how the output is formatted and whether it's exported to Amazon S3. ResultWriter A JSON object that specifies the following details: • Resource The Amazon S3 API action that Step Functions invokes to export the execution results. • Parameters A JSON object that specifies the Amazon S3 bucket name and prefix that stores the execution output. • WriterConfig This field enables you to configure the following options. • Transformation • NONE - returns the output of the child workflow executions unchanged, in addition to the workflow metadata. Default when exporting the child workflow execution results to Amazon S3 and WriterConfig is not specified. • COMPACT - returns the output of the child workflow executions. Default when ResultWriter is not specified. ResultWriter 531 AWS Step Functions Developer Guide • FLATTEN - returns the output of the child workflow executions. If a child workflow execution returns an array, this option flattens the array, prior to returning the result to a state output or writing the result to an Amazon S3 object. Note If a child workflow execution fails, Step Functions returns its execution result unchanged. The results would be equivalent to having set Transformation to NONE. • OutputType • JSON - formats the results as a JSON array. • JSONL - formats the results as JSON Lines. Required field combinations The ResultWriter field cannot be empty. You must specify one of these sets of sub-fields. • WriterConfig - to preview the formatted output, without saving the results to Amazon S3. • Resource and Parameters - to save the results to Amazon S3 without additional formatting. • All three fields: WriterConfig, Resource and Parameters - to format the output and save it to Amazon S3. Example configurations and transformation output The following topics demonstrate the possible configuration settings for ResultWriter and examples of processed results from the different transformation options. • ResultWriter configurations • Transformations Examples of ResultWriter configurations The following examples demonstrate configurations with the possible combinations of the three fields: WriterConfig, Resources and Parameters. Only WriterConfig ResultWriter 532 AWS Step Functions Developer Guide This example configures how the state output is presented in preview, with the output format and transformation specified in the WriterConfig field. Non-existent Resource and Parameters fields, which would have
|
step-functions-dg-165
|
step-functions-dg.pdf
| 165 |
to format the output and save it to Amazon S3. Example configurations and transformation output The following topics demonstrate the possible configuration settings for ResultWriter and examples of processed results from the different transformation options. • ResultWriter configurations • Transformations Examples of ResultWriter configurations The following examples demonstrate configurations with the possible combinations of the three fields: WriterConfig, Resources and Parameters. Only WriterConfig ResultWriter 532 AWS Step Functions Developer Guide This example configures how the state output is presented in preview, with the output format and transformation specified in the WriterConfig field. Non-existent Resource and Parameters fields, which would have provided the Amazon S3 bucket specifications, imply the state output resource. The results are passed on to the next state. "ResultWriter": { "WriterConfig": { "Transformation": "FLATTEN", "OutputType": "JSON" } } Only Resources and Parameters This example exports the state output to the specified Amazon S3 bucket, without the additional formatting and transformation that the non-existent WriterConfig field would have specified. "ResultWriter": { "Resource": "arn:aws:states:::s3:putObject", "Parameters": { "Bucket": "amzn-s3-demo-destination-bucket", "Prefix": "csvProcessJobs" } All three fields: WriterConfig, Resources and Parameters This example formats the state output according the specifications in the WriterConfig field. It also exports it to an Amazon S3 bucket according to the specifications in the Resource and Parameters fields. "ResultWriter": { "WriterConfig": { "Transformation": "FLATTEN", "OutputType": "JSON" }, "Resource": "arn:aws:states:::s3:putObject", "Parameters": { "Bucket": "amzn-s3-demo-destination-bucket", "Prefix": "csvProcessJobs" } } ResultWriter 533 AWS Step Functions Examples of transformations Developer Guide For these examples assume that each child workflow execution returns an output, which is an array of objects. [ { "customer_id": "145538", "order_id": "100000" }, { "customer_id": "898037", "order_id": "100001" } ] These examples demonstrate the formatted output for different Transformation values, with OutputType of JSON. Transformation NONE This is an example of the processed result when you use the NONE transformation. The output is unchanged, and it includes the workflow metadata. [ { "ExecutionArn": "arn:aws:states:region:account-id:execution:orderProcessing/ getOrders:da4e9fc7-abab-3b27-9a77-a277e463b709", "Input": ..., "InputDetails": { "Included": true }, "Name": "da4e9fc7-abab-3b27-9a77-a277e463b709", "Output": "[{\"customer_id\":\"145538\",\"order_id\":\"100000\"},{\"customer_id \":\"898037\",\"order_id\":\"100001\"}]", "OutputDetails": { "Included": true }, "RedriveCount": 0, "RedriveStatus": "NOT_REDRIVABLE", "RedriveStatusReason": "Execution is SUCCEEDED and cannot be redriven", "StartDate": "2025-02-04T01:49:50.099Z", ResultWriter 534 AWS Step Functions Developer Guide "StateMachineArn": "arn:aws:states:region:account- id:stateMachine:orderProcessing/getOrders", "Status": "SUCCEEDED", "StopDate": "2025-02-04T01:49:50.163Z" }, ... { "ExecutionArn": "arn:aws:states:region:account-id:execution:orderProcessing/ getOrders:f43a56f7-d21e-3fe9-a40c-9b9b8d0adf5a", "Input": ..., "InputDetails": { "Included": true }, "Name": "f43a56f7-d21e-3fe9-a40c-9b9b8d0adf5a", "Output": "[{\"customer_id\":\"169881\",\"order_id\":\"100005\"},{\"customer_id \":\"797471\",\"order_id\":\"100006\"}]", "OutputDetails": { "Included": true }, "RedriveCount": 0, "RedriveStatus": "NOT_REDRIVABLE", "RedriveStatusReason": "Execution is SUCCEEDED and cannot be redriven", "StartDate": "2025-02-04T01:49:50.135Z", "StateMachineArn": "arn:aws:states:region:account- id:stateMachine:orderProcessing/getOrders", "Status": "SUCCEEDED", "StopDate": "2025-02-04T01:49:50.227Z" } ] Transformation COMPACT This is an example of the processed result when you use the COMPACT transformation. Note that it’s the combined output of the child workflow executions with the original array structure. [ [ { "customer_id": "145538", "order_id": "100000" }, { "customer_id": "898037", ResultWriter 535 AWS Step Functions Developer Guide "order_id": "100001" } ], ..., [ { "customer_id": "169881", "order_id": "100005" }, { "customer_id": "797471", "order_id": "100006" } ] ] Transformation FLATTEN This is an example of the processed result when you use the FLATTEN transformation. Note that it’s the combined output of the child workflow executions arrays flattened into one array. [ { "customer_id": "145538", "order_id": "100000" }, { "customer_id": "898037", "order_id": "100001" }, ... { "customer_id": "169881", "order_id": "100005" }, { "customer_id": "797471", "order_id": "100006" } ] ResultWriter 536 AWS Step Functions Exporting to Amazon S3 Important Developer Guide Make sure that the Amazon S3 bucket you use to export the results of a Map Run is under the same AWS account and AWS Region as your state machine. Otherwise, your state machine execution will fail with the States.ResultWriterFailed error. Exporting the results to an Amazon S3 bucket is helpful if your output payload size exceeds 256 KiB. Step Functions consolidates all child workflow execution data, such as execution input and output, ARN, and execution status. It then exports executions with the same status to their respective files in the specified Amazon S3 location. The following example, using JSONPath, shows the syntax of the ResultWriter field with Parameters to export the child workflow execution results. In this example, you store the results in a bucket named amzn-s3-demo-destination-bucket within a prefix called csvProcessJobs. { "ResultWriter": { "Resource": "arn:aws:states:::s3:putObject", "Parameters": { "Bucket": "amzn-s3-demo-destination-bucket", "Prefix": "csvProcessJobs" } } } For JSONata states, Parameters will be replaced with Arguments. { "ResultWriter": { "Resource": "arn:aws:states:::s3:putObject", "Arguments": { "Bucket": "amzn-s3-demo-destination-bucket", "Prefix": "csvProcessJobs" } } } ResultWriter 537 AWS Step Functions Tip Developer Guide In Workflow Studio, you can export the child workflow execution results by selecting Export Map state results to Amazon S3. Then, provide the name of the Amazon S3 bucket and prefix where you want to export the results to. Step Functions needs appropriate permissions to access the bucket and folder where you want to export the results. For information about the required IAM policy, see IAM policies for ResultWriter. If you export the child
|
step-functions-dg-166
|
step-functions-dg.pdf
| 166 |
be replaced with Arguments. { "ResultWriter": { "Resource": "arn:aws:states:::s3:putObject", "Arguments": { "Bucket": "amzn-s3-demo-destination-bucket", "Prefix": "csvProcessJobs" } } } ResultWriter 537 AWS Step Functions Tip Developer Guide In Workflow Studio, you can export the child workflow execution results by selecting Export Map state results to Amazon S3. Then, provide the name of the Amazon S3 bucket and prefix where you want to export the results to. Step Functions needs appropriate permissions to access the bucket and folder where you want to export the results. For information about the required IAM policy, see IAM policies for ResultWriter. If you export the child workflow execution results, the Distributed Map state execution returns the Map Run ARN and data about the Amazon S3 export location in the following format: { "MapRunArn": "arn:aws:states:us-east-2:account- id:mapRun:csvProcess/Map:ad9b5f27-090b-3ac6-9beb-243cd77144a7", "ResultWriterDetails": { "Bucket": "amzn-s3-demo-destination-bucket", "Key": "csvProcessJobs/ad9b5f27-090b-3ac6-9beb-243cd77144a7/manifest.json" } } Step Functions exports executions with the same status to their respective files. For example, if your child workflow executions resulted in 500 success and 200 failure results, Step Functions creates two files in the specified Amazon S3 location for the success and failure results. In this example, the success results file contains the 500 success results, while the failure results file contains the 200 failure results. For a given execution attempt, Step Functions creates the following files in the specified Amazon S3 location depending on your execution output: • manifest.json – Contains Map Run metadata, such as export location, Map Run ARN, and information about the result files. If you've redriven a Map Run, the manifest.json file, contains references to all the successful child workflow executions across all the attempts of a Map Run. However, this file contains references to the failed and pending executions for a specific redrive. ResultWriter 538 AWS Step Functions Developer Guide • SUCCEEDED_n.json – Contains the consolidated data for all successful child workflow executions. n represents the index number of the file. The index number starts from 0. For example, SUCCEEDED_1.json. • FAILED_n.json – Contains the consolidated data for all failed, timed out, and aborted child workflow executions. Use this file to recover from failed executions. n represents the index of the file. The index number starts from 0. For example, FAILED_1.json. • PENDING_n.json – Contains the consolidated data for all child workflow executions that weren’t started because the Map Run failed or aborted. n represents the index of the file. The index number starts from 0. For example, PENDING_1.json. Step Functions supports individual result files of up to 5 GB. If a file size exceeds 5 GB, Step Functions creates another file to write the remaining execution results and appends an index number to the file name. For example, if size of the SUCCEEDED_0.json file exceeds 5 GB, Step Functions creates SUCCEEDED_1.json file to record the remaining results. If you didn’t specify to export the child workflow execution results, the state machine execution returns an array of child workflow execution results as shown in the following example: [ { "statusCode": 200, "inputReceived": { "show_id": "s1", "release_year": "2020", "rating": "PG-13", "type": "Movie" } }, { "statusCode": 200, "inputReceived": { "show_id": "s2", "release_year": "2021", "rating": "TV-MA", "type": "TV Show" } }, ... ] ResultWriter 539 AWS Step Functions Note Developer Guide If the returned output size exceeds 256 KiB, the state machine execution fails and returns a States.DataLimitExceeded error. IAM policies for ResultWriter When you create workflows with the Step Functions console, Step Functions can automatically generate IAM policies based on the resources in your workflow definition. These policies include the least privileges necessary to allow the state machine role to invoke the StartExecution API action for the Distributed Map state. These policies also include the least privileges necessary Step Functions to access AWS resources, such as Amazon S3 buckets and objects and Lambda functions. We highly recommend that you include only those permissions that are necessary in your IAM policies. For example, if your workflow includes a Map state in Distributed mode, scope your policies down to the specific Amazon S3 bucket and folder that contains your dataset. Important If you specify an Amazon S3 bucket and object, or prefix, with a reference path to an existing key-value pair in your Distributed Map state input, make sure that you update the IAM policies for your workflow. Scope the policies down to the bucket and object names the path resolves to at runtime. The following IAM policy example grants the least privileges required to write your child workflow execution results to a folder named csvJobs in an Amazon S3 bucket using the PutObject API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload" ResultWriter 540 AWS Step Functions ], "Resource": [ "arn:aws:s3:::amzn-s3-demo-destination-bucket/csvJobs/*" Developer Guide ] } ] } If the Amazon S3 bucket to which you're writing the child workflow execution result is
|
step-functions-dg-167
|
step-functions-dg.pdf
| 167 |
you update the IAM policies for your workflow. Scope the policies down to the bucket and object names the path resolves to at runtime. The following IAM policy example grants the least privileges required to write your child workflow execution results to a folder named csvJobs in an Amazon S3 bucket using the PutObject API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload" ResultWriter 540 AWS Step Functions ], "Resource": [ "arn:aws:s3:::amzn-s3-demo-destination-bucket/csvJobs/*" Developer Guide ] } ] } If the Amazon S3 bucket to which you're writing the child workflow execution result is encrypted using an AWS Key Management Service (AWS KMS) key, you must include the necessary AWS KMS permissions in your IAM policy. For more information, see IAM permissions for AWS KMS key encrypted Amazon S3 bucket. How Step Functions parses input CSV files Managing state and transforming data Learn about Passing data between states with variables and Transforming data with JSONata. Step Functions parses text delimited files based on the following rules: • The delimiter that separates fields is specified by CSVDelimiter in ReaderConfig. The delimiter defaults to COMMA. • Newlines are a delimiter that separates records. • Fields are treated as strings. For data type conversions, use the States.StringToJson intrinsic function in ItemSelector (Map). • Double quotation marks (" ") are not required to enclose strings. However, strings that are enclosed by double quotation marks can contain commas and newlines without acting as record delimiters. • You can preserve double quotes by repeating them. • If the number of fields in a row is less than the number of fields in the header, Step Functions provides empty strings for the missing values. • If the number of fields in a row is more than the number of fields in the header, Step Functions skips the additional fields. Parsing input CSV files 541 AWS Step Functions Developer Guide Example of parsing an input CSV file Say that you have provided a CSV file named myCSVInput.csv that contains one row as input. Then, you've stored this file in an Amazon S3 bucket that's named amzn-s3-demo-bucket. The CSV file is as follows. abc,123,"This string contains commas, a double quotation marks (""), and a newline ( )",{""MyKey"":""MyValue""},"[1,2,3]" The following state machine reads this CSV file and uses ItemSelector (Map) to convert the data types of some of the fields. { "StartAt": "Map", "States": { "Map": { "Type": "Map", "ItemProcessor": { "ProcessorConfig": { "Mode": "DISTRIBUTED", "ExecutionType": "STANDARD" }, "StartAt": "Pass", "States": { "Pass": { "Type": "Pass", "End": true } } }, "End": true, "Label": "Map", "MaxConcurrency": 1000, "ItemReader": { "Resource": "arn:aws:states:::s3:getObject", "ReaderConfig": { "InputType": "CSV", "CSVHeaderLocation": "GIVEN", "CSVHeaders": [ "MyLetters", "MyNumbers", "MyString", "MyObject", Parsing input CSV files 542 Developer Guide AWS Step Functions "MyArray" ] }, "Parameters": { "Bucket": "amzn-s3-demo-bucket", "Key": "myCSVInput.csv" } }, "ItemSelector": { "MyLetters.$": "$$.Map.Item.Value.MyLetters", "MyNumbers.$": "States.StringToJson($$.Map.Item.Value.MyNumbers)", "MyString.$": "$$.Map.Item.Value.MyString", "MyObject.$": "States.StringToJson($$.Map.Item.Value.MyObject)", "MyArray.$": "States.StringToJson($$.Map.Item.Value.MyArray)" } } } } When you run this state machine, it produces the following output. [ { "MyNumbers": 123, "MyObject": { "MyKey": "MyValue" }, "MyString": "This string contains commas, a double quote (\"), and a newline (\n)", "MyLetters": "abc", "MyArray": [ 1, 2, 3 ] } ] Parsing input CSV files 543 AWS Step Functions Developer Guide Integrating services with Step Functions Learn how to call HTTPS APIs and integrate other AWS services with AWS Step Functions. Call other AWS services With AWS service integrations, you can call API actions and coordinate executions directly from your workflow. You can use Step Functions' AWS SDK integrations to call any of the over two hundred AWS services directly from your state machine, giving you access to over nine thousand API actions. Or you can use Step Functions' Optimized integrations, each of which has been customized to provide special functionality for your workflow. Some API actions are available in both types of integration. When possible, we recommend using the Optimized integration. You coordinate these services directly from a Task state in the Amazon States Language. For example, using Step Functions, you can call other services to: • Invoke an AWS Lambda function. • Run an AWS Batch job and then perform different actions based on the results. • Insert or get an item from Amazon DynamoDB. • Run an Amazon Elastic Container Service (Amazon ECS) task and wait for it to complete. • Publish to a topic in Amazon Simple Notification Service (Amazon SNS). • Send a message in Amazon Simple Queue Service (Amazon SQS). • Manage a job for AWS Glue or Amazon SageMaker AI. • Build workflows for executing Amazon EMR jobs. • Launch an AWS Step Functions workflow execution. AWS SDK integrations AWS SDK integrations work exactly like a standard API call using the AWS SDK. They provide the ability to call over nine thousand APIs across the
|
step-functions-dg-168
|
step-functions-dg.pdf
| 168 |
an item from Amazon DynamoDB. • Run an Amazon Elastic Container Service (Amazon ECS) task and wait for it to complete. • Publish to a topic in Amazon Simple Notification Service (Amazon SNS). • Send a message in Amazon Simple Queue Service (Amazon SQS). • Manage a job for AWS Glue or Amazon SageMaker AI. • Build workflows for executing Amazon EMR jobs. • Launch an AWS Step Functions workflow execution. AWS SDK integrations AWS SDK integrations work exactly like a standard API call using the AWS SDK. They provide the ability to call over nine thousand APIs across the more than two hundred AWS services directly from your state machine definition. Call other AWS services 544 AWS Step Functions Developer Guide Optimized integrations Optimized integrations have been customized by Step Functions to provide special functionality for a workflow context. For example, Lambda Invoke converts its API output from an escaped JSON to a JSON object. AWS BatchSubmitJob lets you pause execution until the job is complete. For the full list of optimized integrations, see Integrating optimized services Cross-account access Step Functions provides cross-account access to resources configured in different AWS accounts in your workflows. Using Step Functions service integrations, you can invoke any cross-account AWS resource even if that AWS service does not support resource-based policies or cross-account calls. For more information, see Accessing resources in other AWS accounts in Step Functions. Integration pattern support Standard Workflows and Express Workflows support the same integrations but not the same integration patterns. • Standard Workflows support Request Response integrations. Certain services support Run a Job (.sync), or Wait for Callback (.waitForTaskToken) , and both in some cases. See the following optimized integrations table for details. • Express Workflows only support Request Response integrations. To help decide between the two types, see Choosing workflow type in Step Functions. AWS SDK integrations in Step Functions Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Over two hundred services Standard & Express Not supported Standard Optimized integrations in Step Functions Optimized integrations 545 AWS Step Functions Developer Guide Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Amazon API Gateway Standard & Express Not supported Standard Amazon Athena Standard & Express Standard Not supported AWS Batch Standard & Express Standard Not supported Amazon Bedrock Standard & Express Standard Standard AWS CodeBuild Standard & Express Standard Not supported Amazon DynamoDB Standard & Express Not supported Not supported Amazon ECS/Fargate Standard & Express Standard Amazon EKS Standard & Express Standard Standard Standard Amazon EMR Standard & Express Standard Not supported Amazon EMR on EKS Standard & Express Standard Not supported Amazon EMR Serverless Standard & Express Standard Not supported Amazon EventBridge Standard & Express Not supported Standard AWS Glue Standard & Express Standard Not supported AWS Glue DataBrew Standard & Express Standard Not supported AWS Lambda Standard & Express Not supported Standard AWS Elemental MediaConvert Amazon SageMaker AI Standard & Express Standard Not supported Standard & Express Standard Not supported Amazon SNS Standard & Express Not supported Standard Integration pattern support 546 AWS Step Functions Developer Guide Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Amazon SQS Standard & Express Not supported Standard AWS Step Functions Standard & Express Standard Standard Discover service integration patterns in Step Functions AWS Step Functions integrates with services directly in the Amazon States Language. You can control these AWS services using three service integration patterns: • Call a service and let Step Functions progress to the next state immediately after it gets an HTTP response. • Call a service and have Step Functions wait for a job to complete. • Call a service with a task token and have Step Functions wait until that token is returned with a payload. Each of these service integration patterns is controlled by how you create a URI in the "Resource" field of your task definition. Ways to Call an Integrated Service • Integration pattern support • Request Response • Run a Job (.sync) • Wait for a Callback with Task Token For information about configuring AWS Identity and Access Management (IAM) for integrated services, see How Step Functions generates IAM policies for integrated services. Integration pattern support Standard Workflows and Express Workflows support the same integrations but not the same integration patterns. Service integration patterns 547 AWS Step Functions Developer Guide • Standard Workflows support Request Response integrations. Certain services support Run a Job (.sync), or Wait for Callback (.waitForTaskToken) , and both in some cases. See the following optimized integrations table for details. • Express Workflows only support Request Response integrations. To help decide between the two types, see Choosing workflow type in Step Functions. AWS SDK integrations in Step Functions Integrated service Request Response Run
|
step-functions-dg-169
|
step-functions-dg.pdf
| 169 |
Functions generates IAM policies for integrated services. Integration pattern support Standard Workflows and Express Workflows support the same integrations but not the same integration patterns. Service integration patterns 547 AWS Step Functions Developer Guide • Standard Workflows support Request Response integrations. Certain services support Run a Job (.sync), or Wait for Callback (.waitForTaskToken) , and both in some cases. See the following optimized integrations table for details. • Express Workflows only support Request Response integrations. To help decide between the two types, see Choosing workflow type in Step Functions. AWS SDK integrations in Step Functions Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Over two hundred services Standard & Express Not supported Standard Optimized integrations in Step Functions Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Amazon API Gateway Standard & Express Not supported Standard Amazon Athena Standard & Express Standard Not supported AWS Batch Standard & Express Standard Not supported Amazon Bedrock Standard & Express Standard Standard AWS CodeBuild Standard & Express Standard Not supported Amazon DynamoDB Standard & Express Not supported Not supported Amazon ECS/Fargate Standard & Express Standard Amazon EKS Standard & Express Standard Standard Standard Amazon EMR Standard & Express Standard Not supported Integration pattern support 548 AWS Step Functions Developer Guide Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Amazon EMR on EKS Standard & Express Standard Not supported Amazon EMR Serverless Standard & Express Standard Not supported Amazon EventBridge Standard & Express Not supported Standard AWS Glue Standard & Express Standard Not supported AWS Glue DataBrew Standard & Express Standard Not supported AWS Lambda Standard & Express Not supported Standard AWS Elemental MediaConvert Amazon SageMaker AI Standard & Express Standard Not supported Standard & Express Standard Not supported Amazon SNS Standard & Express Not supported Standard Amazon SQS Standard & Express Not supported Standard AWS Step Functions Standard & Express Standard Standard Request Response When you specify a service in the "Resource" string of your task state, and you only provide the resource, Step Functions will wait for an HTTP response and then progress to the next state. Step Functions will not wait for a job to complete. The following example shows how you can publish an Amazon SNS topic. "Send message to SNS": { "Type":"Task", "Resource":"arn:aws:states:::sns:publish", "Parameters": { Request Response 549 AWS Step Functions Developer Guide "TopicArn":"arn:aws:sns:region:123456789012:myTopic", "Message":"Hello from Step Functions!" }, "Next":"NEXT_STATE" } This example references the Publish API of Amazon SNS. The workflow progresses to the next state after calling the Publish API. Tip To deploy a sample workflow that uses the Request Response service integration pattern, see Integrate a service in the getting started tutorial in this guide, or in the Request Response module in The AWS Step Functions Workshop. Run a Job (.sync) For integrated services such as AWS Batch and Amazon ECS, Step Functions can wait for a request to complete before progressing to the next state. To have Step Functions wait, specify the "Resource" field in your task state definition with the .sync suffix appended after the resource URI. For example, when submitting an AWS Batch job, use the "Resource" field in the state machine definition as shown in this example. "Manage Batch task": { "Type": "Task", "Resource": "arn:aws:states:::batch:submitJob.sync", "Parameters": { "JobDefinition": "arn:aws:batch:us-east-2:123456789012:job-definition/ testJobDefinition", "JobName": "testJob", "JobQueue": "arn:aws:batch:us-east-2:123456789012:job-queue/testQueue" }, "Next": "NEXT_STATE" } Having the .sync portion appended to the resource Amazon Resource Name (ARN) means that Step Functions waits for the job to complete. After calling AWS Batch submitJob, the Run a Job (.sync) 550 AWS Step Functions Developer Guide workflow pauses. When the job is complete, Step Functions progresses to the next state. For more information, see the AWS Batch sample project: Manage a batch job with AWS Batch and Amazon SNS. If a task using this (.sync) service integration pattern is aborted, and Step Functions is unable to cancel the task, you might incur additional charges from the integrated service. A task can be aborted if: • The state machine execution is stopped. • A different branch of a Parallel state fails with an uncaught error. • An iteration of a Map state fails with an uncaught error. Step Functions will make a best-effort attempt to cancel the task. For example, if a Step Functions states:startExecution.sync task is aborted, it will call the Step Functions StopExecution API action. However, it is possible that Step Functions will be unable to cancel the task. Reasons for this include, but are not limited to: • Your IAM execution role lacks permission to make the corresponding API call. • A temporary service outage occurred. When you use the .sync service integration pattern, Step Functions uses polling that consumes your assigned quota and events to monitor a job's status. For .sync invocations
|
step-functions-dg-170
|
step-functions-dg.pdf
| 170 |
error. Step Functions will make a best-effort attempt to cancel the task. For example, if a Step Functions states:startExecution.sync task is aborted, it will call the Step Functions StopExecution API action. However, it is possible that Step Functions will be unable to cancel the task. Reasons for this include, but are not limited to: • Your IAM execution role lacks permission to make the corresponding API call. • A temporary service outage occurred. When you use the .sync service integration pattern, Step Functions uses polling that consumes your assigned quota and events to monitor a job's status. For .sync invocations within the same account, Step Functions uses EventBridge events and polls the APIs that you specify in the Task state. For cross-account .sync invocations, Step Functions only uses polling. For example, for states:StartExecution.sync, Step Functions performs polling on the DescribeExecution API and uses your assigned quota. Tip To deploy an example workflow that uses the .sync integration pattern, see Run a Job (.sync) in The AWS Step Functions Workshop. To see a list of what integrated services support waiting for a job to complete (.sync), see Integrating services with Step Functions. Run a Job (.sync) 551 AWS Step Functions Note Developer Guide Service integrations that use the .sync or .waitForTaskToken patterns require additional IAM permissions. For more information, see How Step Functions generates IAM policies for integrated services. In some cases, you may want Step Functions to continue your workflow before the job is fully complete. You can achieve this in the same way as when using the Wait for a Callback with Task Token service integration pattern. To do this, pass a task token to your job, then return it using a SendTaskSuccess or SendTaskFailure API call. Step Functions will use the data you provide in that call to complete the task, stop monitoring the job, and continue the workflow. Wait for a Callback with Task Token Callback tasks provide a way to pause a workflow until a task token is returned. A task might need to wait for a human approval, integrate with a third party, or call legacy systems. For tasks like these, you can pause Step Functions until the workflow execution reaches the one year service quota (see, Quotas related to state throttling), and wait for an external process or workflow to complete. For these situations Step Functions allows you to pass a task token to the AWS SDK service integrations, and also to some Optimized service integrations. The task will pause until it receives that task token back with a SendTaskSuccess or SendTaskFailure call. If a Task state using the callback task token times out, a new random token is generated. You can access the task tokens from the Context object. Note A task token must contain at least one character, and cannot exceed 1024 characters. To use .waitForTaskToken with an AWS SDK integration, the API you use must have a parameter field in which to place the task token. Note You must pass task tokens from principals within the same AWS account. The tokens won't work if you send them from principals in a different AWS account. Wait for Callback 552 AWS Step Functions Tip Developer Guide To deploy an example workflow that uses a callback task token integration pattern, see Callback with Task Token in The AWS Step Functions Workshop. To see a list of what integrated services support waiting for a task token (.waitForTaskToken), see Integrating services with Step Functions. Topics • Task Token Example • Get a Token from the Context object • Configure a Heartbeat Timeout for a Waiting Task Task Token Example In this example, a Step Functions workflow needs to integrate with an external microservice to perform a credit check as a part of an approval workflow. Step Functions publishes an Amazon SQS message that includes a task token as a part of the message. An external system integrates with Amazon SQS, and pulls the message off the queue. When that's finished, it returns the result and the original task token. Step Functions then continues with its workflow. Wait for Callback 553 AWS Step Functions Developer Guide The "Resource" field of the task definition that references Amazon SQS includes .waitForTaskToken appended to the end. "Send message to SQS": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken", "Parameters": { "QueueUrl": "https://sqs.us-east-2.amazonaws.com/123456789012/myQueue", "MessageBody": { "Message": "Hello from Step Functions!", "TaskToken.$": "$$.Task.Token" } }, "Next": "NEXT_STATE" } Wait for Callback 554 AWS Step Functions Developer Guide This tells Step Functions to pause and wait for the task token. When you specify a resource using .waitForTaskToken, the task token can be accessed in the "Parameters" field of your state definition with a special path designation ($$.Task.Token). The initial $$. designates that the path accesses the Context object, and gets the task token for the current
|
step-functions-dg-171
|
step-functions-dg.pdf
| 171 |
includes .waitForTaskToken appended to the end. "Send message to SQS": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken", "Parameters": { "QueueUrl": "https://sqs.us-east-2.amazonaws.com/123456789012/myQueue", "MessageBody": { "Message": "Hello from Step Functions!", "TaskToken.$": "$$.Task.Token" } }, "Next": "NEXT_STATE" } Wait for Callback 554 AWS Step Functions Developer Guide This tells Step Functions to pause and wait for the task token. When you specify a resource using .waitForTaskToken, the task token can be accessed in the "Parameters" field of your state definition with a special path designation ($$.Task.Token). The initial $$. designates that the path accesses the Context object, and gets the task token for the current task in a running execution. When it's complete, the external service calls SendTaskSuccess or SendTaskFailure with the taskToken included. Only then does the workflow continue to the next state. Note To avoid waiting indefinitely if a process fails to send the task token with SendTaskSuccess or SendTaskFailure, see Configure a Heartbeat Timeout for a Waiting Task. Get a Token from the Context object The Context object is an internal JSON object that contains information about your execution. Like state input, it can be accessed with a path from the "Parameters" field during an execution. When accessed from within a task definition, it includes information about the specific execution, including the task token. { "Execution": { "Id": "arn:aws:states:region:account- id:execution:stateMachineName:executionName", "Input": { "key": "value" }, "Name": "executionName", "RoleArn": "arn:aws:iam::account-id:role...", "StartTime": "2019-03-26T20:14:13.192Z" }, "State": { "EnteredTime": "2019-03-26T20:14:13.192Z", "Name": "Test", "RetryCount": 3 }, "StateMachine": { "Id": "arn:aws:states:region:account-id:stateMachine:stateMachineName", Wait for Callback 555 AWS Step Functions "Name": "name" }, "Task": { Developer Guide "Token": "h7XRiCdLtd/83p1E0dMccoxlzFhglsdkzpK9mBVKZsp7d9yrT1W" } } You can access the task token by using a special path from inside the "Parameters" field of your task definition. To access the input or the Context object, you first specify that the parameter will be a path by appending a .$ to the parameter name. The following specifies nodes from both the input and the Context object in a "Parameters" specification. "Parameters": { "Input.$": "$", "TaskToken.$": "$$.Task.Token" }, In both cases, appending .$ to the parameter name tells Step Functions to expect a path. In the first case, "$" is a path that includes the entire input. In the second case, $$. specifies that the path will access the Context object, and $$.Task.Token sets the parameter to the value of the task token in the Context object of a running execution. In the Amazon SQS example, .waitForTaskToken in the "Resource" field tells Step Functions to wait for the task token to be returned. The "TaskToken.$": "$$.Task.Token" parameter passes that token as a part of the Amazon SQS message. "Send message to SQS": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken", "Parameters": { "QueueUrl": "https://sqs.us-east-2.amazonaws.com/123456789012/myQueue", "MessageBody": { "Message": "Hello from Step Functions!", "TaskToken.$": "$$.Task.Token" } }, "Next": "NEXT_STATE" } For more information about the Context object, see Accessing execution data from the Context object in Step Functions in the Processing input and output section in this guide. Wait for Callback 556 AWS Step Functions Developer Guide Configure a Heartbeat Timeout for a Waiting Task A task that is waiting for a task token will wait until the execution reaches the one year service quota (see, Quotas related to state throttling). To avoid stuck executions you can configure a heartbeat timeout interval in your state machine definition. Use the HeartbeatSeconds field to specify the timeout interval. { "StartAt": "Push to SQS", "States": { "Push to SQS": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken", "HeartbeatSeconds": 600, "Parameters": { "MessageBody": { "myTaskToken.$": "$$.Task.Token" }, "QueueUrl": "https://sqs.us-east-1.amazonaws.com/123456789012/push- based-queue" }, "ResultPath": "$.SQS", "End": true } } } In this state machine definition, a task pushes a message to Amazon SQS and waits for an external process to call back with the provided task token. The "HeartbeatSeconds": 600 field sets the heartbeat timeout interval to 10 minutes. The task will wait for the task token to be returned with one of these API actions: • SendTaskSuccess • SendTaskFailure • SendTaskHeartbeat If the waiting task doesn't receive a valid task token within that 10-minute period, the task fails with a States.Timeout error name. For more information, see the callback task sample project Create a callback pattern example with Amazon SQS, Amazon SNS, and Lambda. Wait for Callback 557 AWS Step Functions Developer Guide Call HTTPS APIs in Step Functions workflows An HTTP Task is a type of Task workflow state state that lets you call an HTTPS API in your workflows. The API can be public, such as third-party SaaS applications like Stripe or Salesforce. You can also call private API, such as HTTPS-based applications in an Amazon Virtual Private Cloud. For authorization and network connectivity, an HTTP Task requires an EventBridge connection. To call an HTTPS API, use the Task state with the arn:aws:states:::http:invoke resource. Then, provide the API endpoint configuration details, such as the API URL, method you want
|
step-functions-dg-172
|
step-functions-dg.pdf
| 172 |
Developer Guide Call HTTPS APIs in Step Functions workflows An HTTP Task is a type of Task workflow state state that lets you call an HTTPS API in your workflows. The API can be public, such as third-party SaaS applications like Stripe or Salesforce. You can also call private API, such as HTTPS-based applications in an Amazon Virtual Private Cloud. For authorization and network connectivity, an HTTP Task requires an EventBridge connection. To call an HTTPS API, use the Task state with the arn:aws:states:::http:invoke resource. Then, provide the API endpoint configuration details, such as the API URL, method you want to use, and connection details. If you use Workflow Studio to build your state machine that contains an HTTP Task, Workflow Studio automatically generates an execution role with IAM policies for the HTTP Task. For more information, see Role for testing HTTP Tasks in Workflow Studio. Note HTTP Task currently only supports public domain names with publicly trusted certificates for HTTPS endpoints when using private APIs. HTTP Task does not support mutual TLS (mTLS). Topics • Connectivity for an HTTP Task • HTTP Task definition • HTTP Task fields • Merging EventBridge connection and HTTP Task definition data • Applying URL-encoding on request body • IAM permissions to run an HTTP Task • HTTP Task example • Testing an HTTP Task • Unsupported HTTP Task responses • Connection errors Call HTTPS APIs 558 AWS Step Functions Developer Guide Connectivity for an HTTP Task An HTTP Task requires an EventBridge connection, which securely manages the authentication credentials of an API provider. A connection defines the authorization method and credentials to use in connecting to a given API. If you are connecting to a private API, such as a private API in an Amazon Virtual Private Cloud (Amazon VPC), you can also use the connection to define secure point-to-point network connectivity. Using a connection helps you avoid hard-coding secrets, such as API keys, into your state machine definition. An EventBridge connection supports the Basic, OAuth, and API Key authorization schemes. When you create an EventBridge connection, you provide your authorization and network connectivity details. You can also include the header, body, and query parameters that are required for authorization with an API. You must include the connection ARN in any HTTP Task that calls an HTTPS API. When you create a connection, EventBridge creates a secret in AWS Secrets Manager. In this secret, EventBridge stores the connection and authorization parameters in an encrypted form. To successfully create or update a connection, you must use an AWS account that has permission to use Secrets Manager. For more information about the IAM permissions your state machine needs to access an EventBridge connection, see IAM permissions to run an HTTP Task. The following image shows how Step Functions handles authorization for HTTPS API calls using an EventBridge connection. The EventBridge connection manages credentials of an HTTPS API provider. EventBridge creates a secret in Secrets Manager to store the connection and authorization parameters in an encrypted form. In the case of private APIs, EventBridge also stores network connectivity configurations. Timeouts for connections HTTP task requests will timeout after 60 seconds. Connectivity for an HTTP Task 559 AWS Step Functions Developer Guide HTTP Task definition The ASL definition represents an HTTP Task with http:invoke resource. The following HTTP Task definition invokes a public Stripe API that returns a list of all customers. "Call HTTPS API": { "Type": "Task", "Resource": "arn:aws:states:::http:invoke", "Parameters": { "ApiEndpoint": "https://api.stripe.com/v1/customers", "Authentication": { "ConnectionArn": "arn:aws:events:region:account-id:connection/ Stripe/81210c42-8af1-456b-9c4a-6ff02fc664ac" }, "Method": "GET" }, "End": true } HTTP Task fields An HTTP Task includes the following fields in its definition. HTTP Task definition 560 AWS Step Functions Resource (Required) Developer Guide To specify a task type, provide its ARN in the Resource field. For an HTTP Task, you specify the Resource field as follows. "Resource": "arn:aws:states:::http:invoke" Parameters (Required) Contains the ApiEndpoint, Method, and ConnectionArn fields that provide information about the HTTPS API you want to call. Parameters also contains optional fields, such as Headers and QueryParameters. You can specify a combination of static JSON and JsonPath syntax as Parameters in the Parameters field. For more information, see Passing parameters to a service API in Step Functions. To specify the EventBridge connection, use either the Authentication or InvocationConfig field. ApiEndpoint (Required) Specifies the URL of the HTTPS API you want to call. To append query parameters to the URL, use the QueryParameters field. The following example shows how you can call a Stripe API to fetch the list of all customers. "ApiEndpoint":"https://api.stripe.com/v1/customers" You can also specify a reference path using the JsonPath syntax to select the JSON node that contains the HTTPS API URL. For example, say you want to call one of Stripe’s APIs using a specific customer ID. Imagine that you've provided the following state input. {
|
step-functions-dg-173
|
step-functions-dg.pdf
| 173 |
the EventBridge connection, use either the Authentication or InvocationConfig field. ApiEndpoint (Required) Specifies the URL of the HTTPS API you want to call. To append query parameters to the URL, use the QueryParameters field. The following example shows how you can call a Stripe API to fetch the list of all customers. "ApiEndpoint":"https://api.stripe.com/v1/customers" You can also specify a reference path using the JsonPath syntax to select the JSON node that contains the HTTPS API URL. For example, say you want to call one of Stripe’s APIs using a specific customer ID. Imagine that you've provided the following state input. { "customer_id": "1234567890", "name": "John Doe" } To retrieve the details of this customer ID using a Stripe API, specify the ApiEndpoint as shown in the following example. This example uses an intrinsic function and a reference path. HTTP Task fields 561 AWS Step Functions Developer Guide "ApiEndpoint.$":"States.Format('https://api.stripe.com/v1/customers/{}', $.customer_id)" At runtime, Step Functions resolves the value of ApiEndpoint as follows. https://api.stripe.com/v1/customers/1234567890 Method (Required) Specifies the HTTP method you want to use for calling an HTTPS API. You can specify one of these methods in your HTTP Task: GET, POST, PUT, DELETE, PATCH, OPTIONS, or HEAD. For example, to use the GET method, specify the Method field as follows. "Method": "GET" You can also use a reference path to specify the method at runtime. For example, "Method. $": "$.myHTTPMethod". Authentication (Conditional) You must specify either Authentication or InvocationConfig. Contains the ConnectionArn field that specifies how to authenticate a public HTTPS API call. Step Functions supports authentication for a specified ApiEndpoint using the connection resource of Amazon EventBridge. ConnectionArn (Required) Specifies the EventBridge connection ARN. An HTTP Task requires an EventBridge connection, which securely manages the authorization credentials of an API provider. A connection specifies the authorization type and credentials to use for authorizing an HTTPS API. Using a connection helps you avoid hard-coding secrets, such as API keys, into your state machine definition. In a connection, you can also specify Headers, QueryParameters, and RequestBody parameters. For more information, see Connectivity for an HTTP Task. The following example shows how you can specify the Authentication field in your HTTP Task definition. HTTP Task fields 562 AWS Step Functions Developer Guide "Authentication": { "ConnectionArn": "arn:aws:events:us-east-2:account-id:connection/ Stripe/81210c42-8af1-456b-9c4a-6ff02fc664ac" } InvocationConfig (Conditional) You must specify either Authentication or InvocationConfig. Contains the authorization and network connectivity configuration for a private HTTPS API call. Step Functions supports connection for a specified ApiEndpoint using the connection resource of Amazon EventBridge. For more information, see Connecting to private APIs in the Amazon EventBridge User Guide. ConnectionArn (Required) Specifies the EventBridge connection ARN. An HTTP Task requires an EventBridge connection, which securely manages the authorization credentials of an API provider. A connection specifies the authorization type and credentials to use for authorizing an HTTPS API. For private APIs, the connection also defines secure point-to-point network connectivity. Using a connection helps you avoid hard-coding secrets, such as API keys, into your state machine definition. In a connection, you can also specify Headers, QueryParameters, and RequestBody parameters. For more information, see Connectivity for an HTTP Task. The following example shows how you can specify an InvocationConfig field in your HTTP Task definition. "InvocationConfig": { "ConnectionArn": "arn:aws:events:region:account-id:connection/connection-id" } Headers (Optional) Provides additional context and metadata to the API endpoint. You can specify headers as a string or JSON array. You can specify headers in the EventBridge connection and the Headers field in an HTTP Task. We recommend that you do not include authentication details to your API providers HTTP Task fields 563 AWS Step Functions Developer Guide in the Headers field. We recommend that you include these details into your EventBridge connection. Step Functions adds the headers that you specify in the EventBridge connection to the headers that you specify in the HTTP Task definition. If the same header keys are present in the definition and connection, Step Functions uses the corresponding values specified in the EventBridge connection for those headers. For more information about how Step Functions performs data merging, see Merging EventBridge connection and HTTP Task definition data. The following example specifies a header that will be included in an HTTPS API call: content-type. "Headers": { "content-type": "application/json" } You can also use a reference path to specify the headers at runtime. For example, "Headers.$": "$.myHTTPHeaders". Step Functions sets the User-Agent, Range, and Host headers. Step Functions sets the value of the Host header based on the API you're calling. The following is an example of these headers. User-Agent: Amazon|StepFunctions|HttpInvoke|region, Range: bytes=0-262144, Host: api.stripe.com You can't use the following headers in your HTTP Task definition. If you use these headers, the HTTP Task fails with the States.Runtime error. • A-IM • Accept-Charset • Accept-Datetime • Accept-Encoding • Cache-Control • Connection • Content-Encoding • Content-MD5 HTTP Task fields 564 AWS Step Functions Developer Guide
|
step-functions-dg-174
|
step-functions-dg.pdf
| 174 |
a reference path to specify the headers at runtime. For example, "Headers.$": "$.myHTTPHeaders". Step Functions sets the User-Agent, Range, and Host headers. Step Functions sets the value of the Host header based on the API you're calling. The following is an example of these headers. User-Agent: Amazon|StepFunctions|HttpInvoke|region, Range: bytes=0-262144, Host: api.stripe.com You can't use the following headers in your HTTP Task definition. If you use these headers, the HTTP Task fails with the States.Runtime error. • A-IM • Accept-Charset • Accept-Datetime • Accept-Encoding • Cache-Control • Connection • Content-Encoding • Content-MD5 HTTP Task fields 564 AWS Step Functions Developer Guide • Date • Expect • Forwarded • From • Host • HTTP2-Settings • If-Match • If-Modified-Since • If-None-Match • If-Range • If-Unmodified-Since • Max-Forwards • Origin • Pragma • Proxy-Authorization • Referer • Server • TE • Trailer • Transfer-Encoding • Upgrade • Via • Warning • x-forwarded-* • x-amz-* • x-amzn-* QueryParameters (Optional) Inserts key-value pairs at the end of an API URL. You can specify query parameters as a string, JSON array, or a JSON object. Step Functions automatically URL-encodes query parameters when it calls an HTTPS API. HTTP Task fields 565 AWS Step Functions Developer Guide For example, say that you want to call the Stripe API to search for customers that do their transactions in US dollars (USD). Imagine that you've provided the following QueryParameters as state input. "QueryParameters": { "currency": "usd" } At runtime, Step Functions appends the QueryParameters to the API URL as follows. https://api.stripe.com/v1/customers/search?currency=usd You can also use a reference path to specify the query parameters at runtime. For example, "QueryParameters.$": "$.myQueryParameters". If you’ve specified query parameters in your EventBridge connection, Step Functions adds these query parameters to the query parameters that you specify in the HTTP Task definition. If the same query parameters keys are present in the definition and connection, Step Functions uses the corresponding values specified in the EventBridge connection for those headers. For more information about how Step Functions performs data merging, see Merging EventBridge connection and HTTP Task definition data. Transform (Optional) Contains the RequestBodyEncoding and RequestEncodingOptions fields. By default, Step Functions sends the request body as JSON data to an API endpoint. If your API provider accepts form-urlencoded request bodies, use the Transform field to specify URL-encoding for the request bodies. You must also specify the content-type header as application/x-www-form-urlencoded. Step Functions then automatically URL-encodes your request body. RequestBodyEncoding Specifies URL-encoding of your request body. You can specify one these values: NONE or URL_ENCODED. • NONE – The HTTP request body will be the serialized JSON of the RequestBody field. This is the default value. • URL_ENCODED – The HTTP request body will be the URL-encoded form data of the RequestBody field. HTTP Task fields 566 AWS Step Functions Developer Guide RequestEncodingOptions Determines the encoding option to use for arrays in your request body if you set RequestBodyEncoding to URL_ENCODED. Step Functions supports the following array encoding options. For more information about these options and their examples, see Applying URL-encoding on request body. • INDICES – Encodes arrays using the index value of array elements. By default, Step Functions uses this encoding option. • REPEAT – Repeats a key for each item in an array. • COMMAS – Encodes all the values in a key as a comma-delimited list of values. • BRACKETS – Repeats a key for each item in an array and appends a bracket, [], to the key to indicate that it is an array. The following example sets URL-encoding for the request body data. It also specifies to use the COMMAS encoding option for arrays in the request body. "Transform": { "RequestBodyEncoding": "URL_ENCODED", "RequestEncodingOptions": { "ArrayFormat": "COMMAS" } } RequestBody (Optional) Accepts JSON data that you provide in the state input. In RequestBody, you can specify a combination of static JSON and JsonPath syntax. For example, say that you provide the following state input: { "CardNumber": "1234567890", "ExpiryDate": "09/25" } To use these values of CardNumber and ExpiryDate in your request body at runtime, you can specify the following JSON data in your request body. "RequestBody": { HTTP Task fields 567 AWS Step Functions Developer Guide "Card": { "Number.$": "$.CardNumber", "Expiry.$": "$.ExpiryDate", "Name": "John Doe", "Address": "123 Any Street, Any Town, USA" } } If the HTTPS API you want to call requires form-urlencoded request bodies, you must specify URL-encoding for your request body data. For more information, see Applying URL- encoding on request body. Merging EventBridge connection and HTTP Task definition data When you invoke an HTTP Task, you can specify data in your EventBridge connection and your HTTP Task definition. This data includes Headers, QueryParameters, and RequestBody parameters. Before calling an HTTPS API, Step Functions merges the request body with the connection body parameters in all cases except if your request
|
step-functions-dg-175
|
step-functions-dg.pdf
| 175 |
"John Doe", "Address": "123 Any Street, Any Town, USA" } } If the HTTPS API you want to call requires form-urlencoded request bodies, you must specify URL-encoding for your request body data. For more information, see Applying URL- encoding on request body. Merging EventBridge connection and HTTP Task definition data When you invoke an HTTP Task, you can specify data in your EventBridge connection and your HTTP Task definition. This data includes Headers, QueryParameters, and RequestBody parameters. Before calling an HTTPS API, Step Functions merges the request body with the connection body parameters in all cases except if your request body is a string and the connection body parameters is non-empty. In this case, the HTTP Task fails with the States.Runtime error. If there are any duplicate keys specified in the HTTP Task definition and the EventBridge connection, Step Functions overwrites the values in the HTTP Task with the values in the connection. The following list describes how Step Functions merges data before calling an HTTPS API: • Headers – Step Functions adds any headers you specified in the connection to the headers in the Headers field of the HTTP Task. If there is a conflict between the header keys, Step Functions uses the values specified in the connection for those headers. For example, if you specified the content-type header in both the HTTP Task definition and EventBridge connection, Step Functions uses the content-type header value specified in the connection. • Query parameters – Step Functions adds any query parameters you specified in the connection to the query parameters in the QueryParameters field of the HTTP Task. If there is a conflict between the query parameter keys, Step Functions uses the values specified in the connection for those query parameters. For example, if you specified the maxItems query parameter in both the HTTP Task definition and EventBridge connection, Step Functions uses the maxItems query parameter value specified in the connection. • Body parameters Merging EventBridge connection and HTTP Task definition data 568 AWS Step Functions Developer Guide • Step Functions adds any request body values specified in the connection to the request body in the RequestBody field of the HTTP Task. If there is a conflict between the request body keys, Step Functions uses the values specified in the connection for the request body. For example, say that you specified a Mode field in the RequestBody of both the HTTP Task definition and EventBridge connection. Step Functions uses the Mode field value you specified in the connection. • If you specify the request body as a string instead of a JSON object, and the EventBridge connection also contains request body, Step Functions can't merge the request body specified in both these places. It fails the HTTP Task with the States.Runtime error. Step Functions applies all transformations and serializes the request body after it completes the merging of the request body. The following example sets the Headers, QueryParameters, and RequestBody fields in both the HTTP Task and EventBridge connection. HTTP Task definition { "Comment": "Data merging example for HTTP Task and EventBridge connection", "StartAt": "ListCustomers", "States": { "ListCustomers": { "Type": "Task", "Resource": "arn:aws:states:::http:invoke", "Parameters": { "Authentication": { "ConnectionArn": "arn:aws:events:region:account- id:connection/Example/81210c42-8af1-456b-9c4a-6ff02fc664ac" }, "ApiEndpoint": "https:/example.com/path", "Method": "GET", "Headers": { "Request-Id": "my_request_id", "Header-Param": "state_machine_header_param" }, "RequestBody": { "Job": "Software Engineer", "Company": "AnyCompany", "BodyParam": "state_machine_body_param" Merging EventBridge connection and HTTP Task definition data 569 AWS Step Functions }, "QueryParameters": { "QueryParam": "state_machine_query_param" Developer Guide } } } } } EventBridge connection { "AuthorizationType": "API_KEY", "AuthParameters": { "ApiKeyAuthParameters": { "ApiKeyName": "ApiKey", "ApiKeyValue": "key_value" }, "InvocationHttpParameters": { "BodyParameters": [ { "Key": "BodyParam", "Value": "connection_body_param" } ], "HeaderParameters": [ { "Key": "Header-Param", "Value": "connection_header_param" } ], "QueryStringParameters": [ { "Key": "QueryParam", "Value": "connection_query_param" } ] } } } Merging EventBridge connection and HTTP Task definition data 570 AWS Step Functions Developer Guide In this example, duplicate keys are specified in the HTTP Task and EventBridge connection. Therefore, Step Functions overwrites the values in the HTTP Task with the values in the connection. The following code snippet shows the HTTP request that Step Functions sends to the HTTPS API. POST /path?QueryParam=connection_query_param HTTP/1.1 Apikey: key_value Content-Length: 79 Content-Type: application/json; charset=UTF-8 Header-Param: connection_header_param Host: example.com Range: bytes=0-262144 Request-Id: my_request_id User-Agent: Amazon|StepFunctions|HttpInvoke|region {"Job":"Software Engineer","Company":"AnyCompany","BodyParam":"connection_body_param"} Applying URL-encoding on request body By default, Step Functions sends the request body as JSON data to an API endpoint. If your HTTPS API provider requires form-urlencoded request bodies, you must specify URL-encoding for the request bodies. Step Functions then automatically URL-encodes the request body based on the URL-encoding option you select. You specify URL-encoding using the Transform field. This field contains the RequestBodyEncoding field that specifies whether or not you want to apply URL-encoding for your request bodies. When you specify the RequestBodyEncoding field, Step Functions converts your JSON request body to form-urlencoded request body before calling
|
step-functions-dg-176
|
step-functions-dg.pdf
| 176 |
{"Job":"Software Engineer","Company":"AnyCompany","BodyParam":"connection_body_param"} Applying URL-encoding on request body By default, Step Functions sends the request body as JSON data to an API endpoint. If your HTTPS API provider requires form-urlencoded request bodies, you must specify URL-encoding for the request bodies. Step Functions then automatically URL-encodes the request body based on the URL-encoding option you select. You specify URL-encoding using the Transform field. This field contains the RequestBodyEncoding field that specifies whether or not you want to apply URL-encoding for your request bodies. When you specify the RequestBodyEncoding field, Step Functions converts your JSON request body to form-urlencoded request body before calling the HTTPS API. You must also specify the content-type header as application/x-www-form-urlencoded because APIs that accept URL-encoded data expect the content-type header. To encode arrays in your request body, Step Functions provides the following array encoding options. • INDICES – Repeats a key for each item in an array and appends a bracket, [], to the key to indicate that it is an array. This bracket contains the index of the array element. Adding the index helps you specify the order of the array elements. By default, Step Functions uses this encoding option. For example, if your request body contains the following array. Applying URL-encoding on request body 571 AWS Step Functions Developer Guide {"array": ["a","b","c","d"]} Step Functions encodes this array to the following string. array[0]=a&array[1]=b&array[2]=c&array[3]=d • REPEAT – Repeats a key for each item in an array. For example, if your request body contains the following array. {"array": ["a","b","c","d"]} Step Functions encodes this array to the following string. array=a&array=b&array=c&array=d • COMMAS – Encodes all the values in a key as a comma-delimited list of values. For example, if your request body contains the following array. {"array": ["a","b","c","d"]} Step Functions encodes this array to the following string. array=a,b,c,d • BRACKETS – Repeats a key for each item in an array and appends a bracket, [], to the key to indicate that it is an array. For example, if your request body contains the following array. {"array": ["a","b","c","d"]} Step Functions encodes this array to the following string. array[]=a&array[]=b&array[]=c&array[]=d Applying URL-encoding on request body 572 AWS Step Functions Developer Guide IAM permissions to run an HTTP Task Your state machine execution role must have the following permissions for an HTTP Task to call an HTTPS API: • states:InvokeHTTPEndpoint • events:RetrieveConnectionCredentials • secretsmanager:GetSecretValue • secretsmanager:DescribeSecret The following IAM policy example grants the least privileges required to your state machine role for calling Stripe APIs. This IAM policy also grants permission to the state machine role to access a specific EventBridge connection, including the secret for this connection that is stored in Secrets Manager. { "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Action": "states:InvokeHTTPEndpoint", "Resource": "arn:aws:states:us-east-2:account- id:stateMachine:myStateMachine", "Condition": { "StringEquals": { "states:HTTPMethod": "GET" }, "StringLike": { "states:HTTPEndpoint": "https://api.stripe.com/*" } } }, { "Sid": "Statement2", "Effect": "Allow", "Action": [ "events:RetrieveConnectionCredentials" ], IAM permissions to run an HTTP Task 573 AWS Step Functions Developer Guide "Resource": "arn:aws:events:us-east-2:account- id:connection/oauth_connection/aeabd89e-d39c-4181-9486-9fe03e6f286a" }, { "Sid": "Statement3", "Effect": "Allow", "Action": [ "secretsmanager:GetSecretValue", "secretsmanager:DescribeSecret" ], "Resource": "arn:aws:secretsmanager:*:*:secret:events!connection/*" } ] } HTTP Task example The following state machine definition shows an HTTP Task that includes the Headers, QueryParameters, Transform, and RequestBody parameters. The HTTP Task calls a Stripe API, https://api.stripe.com/v1/invoices, to generate an invoice. The HTTP Task also specifies URL- encoding for the request body using the INDICES encoding option. Make sure that you've created an EventBridge connection. The following example shows a connection created using BASIC auth type. { "Type": "BASIC", "AuthParameters": { "BasicAuthParameters": { "Password": "myPassword", "Username": "myUsername" }, } } Remember to replace the italicized text with your resource-specific information. { "Comment": "A state machine that uses HTTP Task", "StartAt": "CreateInvoiceAPI", "States": { "CreateInvoiceAPI": { HTTP Task example 574 AWS Step Functions "Type": "Task", Developer Guide "Resource": "arn:aws:states:::http:invoke", "Parameters": { "ApiEndpoint": "https://api.stripe.com/v1/invoices", "Method": "POST", "Authentication": { "ConnectionArn": ""arn:aws:events:region:account-id:connection/ Stripe/81210c42-8af1-456b-9c4a-6ff02fc664ac" }, "Headers": { "Content-Type": "application/x-www-form-urlencoded" }, "RequestBody": { "customer.$": "$.customer_id", "description": "Monthly subscription", "metadata": { "order_details": "monthly report data" } }, "Transform": { "RequestBodyEncoding": "URL_ENCODED", "RequestEncodingOptions": { "ArrayFormat": "INDICES" } } }, "Retry": [ { "ErrorEquals": [ "States.Http.StatusCode.429", "States.Http.StatusCode.503", "States.Http.StatusCode.504", "States.Http.StatusCode.502" ], "BackoffRate": 2, "IntervalSeconds": 1, "MaxAttempts": 3, "JitterStrategy": "FULL" } ], "Catch": [ { "ErrorEquals": [ "States.Http.StatusCode.404", HTTP Task example 575 AWS Step Functions Developer Guide "States.Http.StatusCode.400", "States.Http.StatusCode.401", "States.Http.StatusCode.409", "States.Http.StatusCode.500" ], "Comment": "Handle all non 200 ", "Next": "HandleInvoiceFailure" } ], "End": true } } } To run this state machine, provide the customer ID as the input as shown in the following example: { "customer_id": "1234567890" } The following example shows the HTTP request that Step Functions sends to the Stripe API. POST /v1/invoices HTTP/1.1 Authorization: Basic <base64 of username and password> Content-Type: application/x-www-form-urlencoded Host: api.stripe.com Range: bytes=0-262144 Transfer-Encoding: chunked User-Agent: Amazon|StepFunctions|HttpInvoke|region description=Monthly%20subscription&metadata%5Border_details%5D=monthly%20report %20data&customer=1234567890 Testing an HTTP Task You can use the TestState API through the console,
|
step-functions-dg-177
|
step-functions-dg.pdf
| 177 |
Task example 575 AWS Step Functions Developer Guide "States.Http.StatusCode.400", "States.Http.StatusCode.401", "States.Http.StatusCode.409", "States.Http.StatusCode.500" ], "Comment": "Handle all non 200 ", "Next": "HandleInvoiceFailure" } ], "End": true } } } To run this state machine, provide the customer ID as the input as shown in the following example: { "customer_id": "1234567890" } The following example shows the HTTP request that Step Functions sends to the Stripe API. POST /v1/invoices HTTP/1.1 Authorization: Basic <base64 of username and password> Content-Type: application/x-www-form-urlencoded Host: api.stripe.com Range: bytes=0-262144 Transfer-Encoding: chunked User-Agent: Amazon|StepFunctions|HttpInvoke|region description=Monthly%20subscription&metadata%5Border_details%5D=monthly%20report %20data&customer=1234567890 Testing an HTTP Task You can use the TestState API through the console, SDK, or the AWS CLI to test an HTTP Task. The following procedure describes how to use the TestState API in the Step Functions console. You can iteratively test the API request, response, and authentication details until your HTTP Task is working as expected. Testing an HTTP Task 576 AWS Step Functions Developer Guide Test an HTTP Task state in Step Functions console 1. Open the Step Functions console. 2. Choose Create state machine to start creating a state machine or choose an existing state machine that contains an HTTP Task. Refer Step 4 if you're testing the task in an existing state machine. 3. In the Design mode of Workflow Studio, configure an HTTP Task visually. Or choose the Code mode to copy-paste the state machine definition from your local development environment. 4. 5. In Design mode, choose Test state in the Inspector panel panel of Workflow Studio. In the Test state dialog box, do the following: a. b. c. For Execution role, choose an execution role to test the state. If you don't have a role with sufficient permissions for an HTTP Task, see Role for testing HTTP Tasks in Workflow Studio to create a role. (Optional) Provide any JSON input that your selected state needs for the test. For Inspection level, keep the default selection of INFO. This level shows you the status of the API call and the state output. This is useful for quickly checking the API response. d. Choose Start test. e. If the test succeeds, the state output appears on the right side of the Test state dialog box. If the test fails, an error appears. In the State details tab of the dialog box, you can see the state definition and a link to your EventBridge connection. f. Change the Inspection level to TRACE. This level shows you the raw HTTP request and response, and is useful for verifying headers, query parameters, and other API-specific details. g. Choose the Reveal secrets checkbox. In combination with TRACE, this setting lets you see the sensitive data that the EventBridge connection inserts, such as API keys. The IAM user identity that you use to access the console must have permission to perform the states:RevealSecrets action. Without this permission, Step Functions throws an access denied error when you start the test. For an example of an IAM policy that sets the states:RevealSecrets permission, see IAM permissions for using TestState API. Testing an HTTP Task 577 AWS Step Functions Developer Guide The following image shows a test for an HTTP Task that succeeds. The Inspection level for this state is set to TRACE. The HTTP request & response tab in the following image shows the result of the HTTPS API call. h. Choose Start test. i. If the test succeeds, you can see your HTTP details under the HTTP request & response tab. Unsupported HTTP Task responses An HTTP Task fails with the States.Runtime error if one of the following conditions is true for the response returned: Unsupported HTTP Task responses 578 AWS Step Functions Developer Guide • The response contains a content-type header of application/octet-stream, image/*, video/*, or audio/*. • The response can't be read as a valid string. For example, binary or image data. Connection errors If EventBridge encounters an issue when connecting to the specified API during workflow execution, Step Functions raises the error in your workflow. Connection errors are prefixed with Events.ConnectionResource.. These errors include: • Events.ConnectionResource.InvalidConnectionState • Events.ConnectionResource.InvalidPrivateConnectionState • Events.ConnectionResource.AccessDenied • Events.ConnectionResource.ResourceNotFound • Events.ConnectionResource.AuthInProgress • Events.ConnectionResource.ConcurrentModification • Events.ConnectionResource.InternalError Passing parameters to a service API in Step Functions Managing state and transforming data Learn about Passing data between states with variables and Transforming data with JSONata. Use the Parameters field in a Task state to control what parameters are passed to a service API. Inside the Parameters field, you must use the plural form of the array parameters in an API action. For example, if you use the Filter field of the DescribeSnapshots API action for integrating with Amazon EC2, you must define the field as Filters. If you don't use the plural form, Step Functions returns the following error: Connection errors 579 AWS Step Functions Developer Guide The field Filter is not
|
step-functions-dg-178
|
step-functions-dg.pdf
| 178 |
Learn about Passing data between states with variables and Transforming data with JSONata. Use the Parameters field in a Task state to control what parameters are passed to a service API. Inside the Parameters field, you must use the plural form of the array parameters in an API action. For example, if you use the Filter field of the DescribeSnapshots API action for integrating with Amazon EC2, you must define the field as Filters. If you don't use the plural form, Step Functions returns the following error: Connection errors 579 AWS Step Functions Developer Guide The field Filter is not supported by Step Functions. Pass static JSON as parameters You can include a JSON object directly in your state machine definition to pass as a parameter to a resource. For example, to set the RetryStrategy parameter for the SubmitJob API for AWS Batch, you could include the following in your parameters. "RetryStrategy": { "attempts": 5 } You can also pass multiple parameters with static JSON. As a more complete example, the following are the Resource and Parameters fields of the specification of a task that publishes to an Amazon SNS topic named myTopic. "Resource": "arn:aws:states:::sns:publish", "Parameters": { "TopicArn": "arn:aws:sns:us-east-2:account-id:myTopic", "Message": "test message", "MessageAttributes": { "my attribute no 1": { "DataType": "String", "StringValue": "value of my attribute no 1" }, "my attribute no 2": { "DataType": "String", "StringValue": "value of my attribute no 2" } } }, Pass state input as parameters using Paths You can pass portions of the state input as parameters by using paths. A path is a string, beginning with $, that's used to identify components within JSON text. Step Functions paths use JsonPath syntax. Pass static JSON as parameters 580 AWS Step Functions Developer Guide To specify that a parameter use a path, end the parameter name with .$. For example, if your state input contains text within a node named message, you could pass that text as a parameter using a path. Consider the following state input: { "comment": "A message in the state input", "input": { "message": "foo", "otherInfo": "bar" }, "data": "example" } To pass the value of the node named message as a parameter named myMessage, specify the following syntax: "Parameters": {"myMessage.$": "$.input.message"}, Step Functions then passes the value foo as a parameter. For more information about using parameters in Step Functions, see the following: • Processing input and output • Manipulate parameters in Step Functions workflows Pass Context object nodes as parameters In addition to static content, and nodes from the state input, you can pass nodes from the Context object as parameters. The Context object is dynamic JSON data that exists during a state machine execution. It includes information about your state machine and the current execution. You can access the Context object using a path in the Parameters field of a state definition. For more information about the Context object and how to access that data from a "Parameters" field, see the following: • Accessing execution data from the Context object in Step Functions • Accessing the Context object Pass Context object nodes as parameters 581 AWS Step Functions Developer Guide • Get a Token from the Context object Learning to use AWS service SDK integrations in Step Functions With Step Functions' AWS SDK integration, your workflows can call almost any AWS service's API actions. The services or SDKs that are not available might be recently released, require customized configuration, or are not suitable for use in a workflow, such as SDKs for streaming audio or video. Topics • Using AWS SDK service integrations • Supported AWS SDK service integrations • Deprecated AWS SDK service integrations Using AWS SDK service integrations To use AWS SDK integrations, you specify the service name and API call and, optionally, a service integration pattern. Note • Parameters in Step Functions are expressed in PascalCase, even if the native service API is in camelCase. For example, you could use the Step Functions API action startSyncExecution and specify its parameter as StateMachineArn. • For API actions that accept enumerated parameters, such as the DescribeLaunchTemplateVersions API action for Amazon EC2, specify a plural version of the parameter name. For example, specify Filters for the Filter.N parameter of the DescribeLaunchTemplateVersions API action. You can call AWS SDK services directly from the Amazon States Language in the Resource field of a task state. To do this, use the following syntax: arn:aws:states:::aws-sdk:serviceName:apiAction.[serviceIntegrationPattern] For example, you might use arn:aws:states:::aws-sdk:ec2:describeInstances to return output as defined for the Amazon EC2 describeInstances API call. AWS SDK integrations 582 AWS Step Functions Developer Guide If an AWS SDK integration encounters an error, the resulting Error field will be composed of the service name and the error name, separated by a period: ServiceName.ErrorName. Both the service name and error name are in Pascal case. You
|
step-functions-dg-179
|
step-functions-dg.pdf
| 179 |
of the DescribeLaunchTemplateVersions API action. You can call AWS SDK services directly from the Amazon States Language in the Resource field of a task state. To do this, use the following syntax: arn:aws:states:::aws-sdk:serviceName:apiAction.[serviceIntegrationPattern] For example, you might use arn:aws:states:::aws-sdk:ec2:describeInstances to return output as defined for the Amazon EC2 describeInstances API call. AWS SDK integrations 582 AWS Step Functions Developer Guide If an AWS SDK integration encounters an error, the resulting Error field will be composed of the service name and the error name, separated by a period: ServiceName.ErrorName. Both the service name and error name are in Pascal case. You can also see the service name in the Task state's Resource field in lowercase. The target service's API reference documentation lists the potential error names. Consider an example where you might use the AWS SDK integration arn:aws:states:::aws- sdk:acmpca:deleteCertificateAuthority. The AWS Private Certificate Authority API Reference indicates that the DeleteCertificateAuthority API action can result in an error named ResourceNotFoundException. To handle this error you would specify the Error AcmPca.ResourceNotFoundException in your Task state's Retriers or Catchers. Note Some AWS services don't include the Exception suffix in the The API Reference documentation. Despite this alternate naming convention, always include the Exception suffix for the potential error names in your AWS Step Functions integration. Do so even when the suffix is not already part of the error name provided by the service. Consider another error name, this time the CreateBucket action. The Amazon Simple Storage Service API Reference lists the error BucketAlreadyExists. Note that it doesn't have the Exception suffix. To handle this error in Step Functions, refer to it as S3.BucketAlreadyExistsException. The S3 service error naming convention differs from the errors in the previously mentioned AWS Private Certificate Authority API Reference. Regardless, in both cases you must include the Exception suffix for potential errors in the Step Functions integration. For more information about error handling, see Handling errors in Step Functions workflows. Step Functions cannot autogenerate IAM policies for AWS SDK integrations. After you create your state machine, you will need to navigate to the IAM console and configure your role policies. See How Step Functions generates IAM policies for integrated services for more information. See the Gather Amazon S3 bucket info using AWS SDK service integrations tutorial for an example of how to use AWS SDK integrations. Using service integrations 583 AWS Step Functions Developer Guide Supported AWS SDK service integrations The Task state resource (Resource) shows the syntax to call a specific API action for the service. The Exception prefix is present in the exceptions that are generated when you erroneously perform an AWS SDK service integration with Step Functions. Important New actions and updates to already supported actions, such as new parameters, will not be immediately available after service SDK updates. Amazon A2I Task state resource: arn:aws:states:::aws-sdk:sagemakera2iruntime:[apiAction] Exception prefix: SageMakerA2IRuntime API Gateway V1 Task state resource: arn:aws:states:::aws-sdk:apigateway:[apiAction] Exception prefix: ApiGateway API Gateway V2 Task state resource: arn:aws:states:::aws-sdk:apigatewayv2:[apiAction] Exception prefix: ApiGatewayV2 AWS Account Management Task state resource: arn:aws:states:::aws-sdk:account:[apiAction] Exception prefix: Account AWS Amplify Task state resource: arn:aws:states:::aws-sdk:amplify:[apiAction] Exception prefix: Amplify Amplify Backend Task state resource: arn:aws:states:::aws-sdk:amplifybackend:[apiAction] Supported service integrations 584 AWS Step Functions Developer Guide Exception prefix: AmplifyBackend Amplify UI Builder Task state resource: arn:aws:states:::aws-sdk:amplifyuibuilder:[apiAction] Exception prefix: AmplifyUiBuilder AWS App Mesh Task state resource: arn:aws:states:::aws-sdk:appmesh:[apiAction] Exception prefix: AppMesh AWS App Runner Task state resource: arn:aws:states:::aws-sdk:apprunner:[apiAction] Exception prefix: AppRunner AWS AppConfig Task state resource: arn:aws:states:::aws-sdk:appconfig:[apiAction] Exception prefix: AppConfig AWS AppConfig Data Task state resource: arn:aws:states:::aws-sdk:appconfigdata:[apiAction] Exception prefix: AppConfigData AWS AppFabric Task state resource: arn:aws:states:::aws-sdk:appfabric:[apiAction] Exception prefix: AppFabric AppIntegrations Task state resource: arn:aws:states:::aws-sdk:appintegrations:[apiAction] Exception prefix: AppIntegrations Amazon AppStream Task state resource: arn:aws:states:::aws-sdk:appstream:[apiAction] Supported service integrations 585 AWS Step Functions Exception prefix: AppStream AWS AppSync Developer Guide Task state resource: arn:aws:states:::aws-sdk:appsync:[apiAction] Exception prefix: AppSync Amazon Appflow Task state resource: arn:aws:states:::aws-sdk:appflow:[apiAction] Exception prefix: Appflow Application Auto Scaling Task state resource: arn:aws:states:::aws- sdk:applicationautoscaling:[apiAction] Exception prefix: ApplicationAutoScaling Application Cost Profiler Task state resource: arn:aws:states:::aws- sdk:applicationcostprofiler:[apiAction] Exception prefix: ApplicationCostProfiler Application Discovery Service Task state resource: arn:aws:states:::aws-sdk:applicationdiscovery:[apiAction] Exception prefix: ApplicationDiscovery Unsupported operations: DescribeExportConfigurations, ExportConfigurations Application Migration Service Task state resource: arn:aws:states:::aws-sdk:mgn:[apiAction] Exception prefix: Mgn Amazon Athena Task state resource: arn:aws:states:::aws-sdk:athena:[apiAction] Exception prefix: Athena Supported service integrations 586 AWS Step Functions Audit Manager Developer Guide Task state resource: arn:aws:states:::aws-sdk:auditmanager:[apiAction] Exception prefix: AuditManager Amazon Aurora DSQL Task state resource: arn:aws:states:::aws-sdk:dsql:[apiAction] Exception prefix: Dsql AWS Auto Scaling Task state resource: arn:aws:states:::aws-sdk:autoscalingplans:[apiAction] Exception prefix: AutoScalingPlans B2B Data Interchange Task state resource: arn:aws:states:::aws-sdk:b2bi:[apiAction] Exception prefix: B2Bi AWS Backup Task state resource: arn:aws:states:::aws-sdk:backup:[apiAction] Exception prefix: Backup AWS Backup Gateway Task state resource: arn:aws:states:::aws-sdk:backupgateway:[apiAction] Exception prefix: BackupGateway AWS Backup Search Task state resource: arn:aws:states:::aws-sdk:backupsearch:[apiAction] Exception prefix: BackupSearch AWS Batch Task state resource: arn:aws:states:::aws-sdk:batch:[apiAction] Exception prefix: Batch Supported service integrations 587 AWS Step Functions Amazon Bedrock Developer Guide Task state resource: arn:aws:states:::aws-sdk:bedrock:[apiAction] Exception prefix: Bedrock Amazon Bedrock Agents Task state resource: arn:aws:states:::aws-sdk:bedrockagent:[apiAction] Exception prefix: BedrockAgent Amazon
|
step-functions-dg-180
|
step-functions-dg.pdf
| 180 |
Exception prefix: AuditManager Amazon Aurora DSQL Task state resource: arn:aws:states:::aws-sdk:dsql:[apiAction] Exception prefix: Dsql AWS Auto Scaling Task state resource: arn:aws:states:::aws-sdk:autoscalingplans:[apiAction] Exception prefix: AutoScalingPlans B2B Data Interchange Task state resource: arn:aws:states:::aws-sdk:b2bi:[apiAction] Exception prefix: B2Bi AWS Backup Task state resource: arn:aws:states:::aws-sdk:backup:[apiAction] Exception prefix: Backup AWS Backup Gateway Task state resource: arn:aws:states:::aws-sdk:backupgateway:[apiAction] Exception prefix: BackupGateway AWS Backup Search Task state resource: arn:aws:states:::aws-sdk:backupsearch:[apiAction] Exception prefix: BackupSearch AWS Batch Task state resource: arn:aws:states:::aws-sdk:batch:[apiAction] Exception prefix: Batch Supported service integrations 587 AWS Step Functions Amazon Bedrock Developer Guide Task state resource: arn:aws:states:::aws-sdk:bedrock:[apiAction] Exception prefix: Bedrock Amazon Bedrock Agents Task state resource: arn:aws:states:::aws-sdk:bedrockagent:[apiAction] Exception prefix: BedrockAgent Amazon Bedrock Runtime Task state resource: arn:aws:states:::aws-sdk:bedrockruntime:[apiAction] Exception prefix: BedrockRuntime Unsupported operations: InvokeModelWithResponseStream, ConverseStream Amazon Bedrock Runtime Agents Task state resource: arn:aws:states:::aws-sdk:bedrockagentruntime:[apiAction] Exception prefix: BedrockAgentRuntime Unsupported operations: InvokeAgent, InvokeFlow, InvokeInlineAgent, OptimizePrompt, RetrieveAndGenerateStream AWS Billing Task state resource: arn:aws:states:::aws-sdk:billing:[apiAction] Exception prefix: Billing AWS Billing Conductor Task state resource: arn:aws:states:::aws-sdk:billingconductor:[apiAction] Exception prefix: Billingconductor AWS Billing and Cost Management Pricing Calculator Task state resource: arn:aws:states:::aws-sdk:bcmpricingcalculator:[apiAction] Exception prefix: BcmPricingCalculator Supported service integrations 588 AWS Step Functions Amazon Braket Developer Guide Task state resource: arn:aws:states:::aws-sdk:braket:[apiAction] Exception prefix: Braket AWS Budgets Task state resource: arn:aws:states:::aws-sdk:budgets:[apiAction] Exception prefix: Budgets Certificate Manager Task state resource: arn:aws:states:::aws-sdk:acm:[apiAction] Exception prefix: Acm Certificate Manager PCA Task state resource: arn:aws:states:::aws-sdk:acmpca:[apiAction] Exception prefix: AcmPca Amazon Chime Task state resource: arn:aws:states:::aws-sdk:chime:[apiAction] Exception prefix: Chime Amazon Chime Identity Task state resource: arn:aws:states:::aws-sdk:chimesdkidentity:[apiAction] Exception prefix: ChimeSdkIdentity Amazon Chime Media Pipelines Task state resource: arn:aws:states:::aws- sdk:chimesdkmediapipelines:[apiAction] Exception prefix: ChimeSdkMediaPipelines Amazon Chime Meetings Task state resource: arn:aws:states:::aws-sdk:chimesdkmeetings:[apiAction] Exception prefix: ChimeSdkMeetings Supported service integrations 589 AWS Step Functions Amazon Chime Messaging Developer Guide Task state resource: arn:aws:states:::aws-sdk:chimesdkmessaging:[apiAction] Exception prefix: ChimeSdkMessaging Amazon Chime Voice Task state resource: arn:aws:states:::aws-sdk:chimesdkvoice:[apiAction] Exception prefix: ChimeSdkVoice AWS Clean Rooms Task state resource: arn:aws:states:::aws-sdk:cleanrooms:[apiAction] Exception prefix: CleanRooms AWS Clean Rooms ML Task state resource: arn:aws:states:::aws-sdk:cleanroomsml:[apiAction] Exception prefix: CleanRoomsMl AWS Cloud Control Task state resource: arn:aws:states:::aws-sdk:cloudcontrol:[apiAction] Exception prefix: CloudControl Cloud Directory Task state resource: arn:aws:states:::aws-sdk:clouddirectory:[apiAction] Exception prefix: CloudDirectory AWS Cloud Map Task state resource: arn:aws:states:::aws-sdk:servicediscovery:[apiAction] Exception prefix: ServiceDiscovery AWS Cloud9 Task state resource: arn:aws:states:::aws-sdk:cloud9:[apiAction] Exception prefix: Cloud9 Supported service integrations 590 AWS Step Functions CloudFormation Developer Guide Task state resource: arn:aws:states:::aws-sdk:cloudformation:[apiAction] Exception prefix: CloudFormation CloudFront Task state resource: arn:aws:states:::aws-sdk:cloudfront:[apiAction] Exception prefix: CloudFront Amazon CloudFront KeyValueStore Task state resource: arn:aws:states:::aws- sdk:cloudfrontkeyvaluestore:[apiAction] Exception prefix: CloudFrontKeyValueStore CloudHSM V1 Task state resource: arn:aws:states:::aws-sdk:cloudhsm:[apiAction] Exception prefix: CloudHsm CloudHSM V2 Task state resource: arn:aws:states:::aws-sdk:cloudhsmv2:[apiAction] Exception prefix: CloudHsmV2 CloudSearch Task state resource: arn:aws:states:::aws-sdk:cloudsearch:[apiAction] Exception prefix: CloudSearch CloudTrail Task state resource: arn:aws:states:::aws-sdk:cloudtrail:[apiAction] Exception prefix: CloudTrail CloudTrail Data Task state resource: arn:aws:states:::aws-sdk:cloudtraildata:[apiAction] Exception prefix: CloudTrailData Supported service integrations 591 AWS Step Functions CloudWatch Developer Guide Task state resource: arn:aws:states:::aws-sdk:cloudwatch:[apiAction] Exception prefix: CloudWatch CloudWatch Application Insights Task state resource: arn:aws:states:::aws-sdk:applicationinsights:[apiAction] Exception prefix: ApplicationInsights Amazon CloudWatch Application Signals Task state resource: arn:aws:states:::aws-sdk:applicationsignals:[apiAction] Exception prefix: ApplicationSignals CloudWatch Internet Monitor Task state resource: arn:aws:states:::aws-sdk:internetmonitor:[apiAction] Exception prefix: InternetMonitor CloudWatch Logs Task state resource: arn:aws:states:::aws-sdk:cloudwatchlogs:[apiAction] Exception prefix: CloudWatchLogs Unsupported operations: StartLiveTail CloudWatch Observability Access Manager Task state resource: arn:aws:states:::aws-sdk:oam:[apiAction] Exception prefix: Oam CloudWatch Observability Admin Service Task state resource: arn:aws:states:::aws-sdk:observabilityadmin:[apiAction] Exception prefix: ObservabilityAdmin CloudWatch RUM Task state resource: arn:aws:states:::aws-sdk:rum:[apiAction] Supported service integrations 592 AWS Step Functions Exception prefix: Rum CloudWatch Synthetics Developer Guide Task state resource: arn:aws:states:::aws-sdk:synthetics:[apiAction] Exception prefix: Synthetics CodeArtifact Task state resource: arn:aws:states:::aws-sdk:codeartifact:[apiAction] Exception prefix: Codeartifact CodeBuild Task state resource: arn:aws:states:::aws-sdk:codebuild:[apiAction] Exception prefix: CodeBuild Amazon CodeCatalyst Task state resource: arn:aws:states:::aws-sdk:codecatalyst:[apiAction] Exception prefix: CodeCatalyst CodeCommit Task state resource: arn:aws:states:::aws-sdk:codecommit:[apiAction] Exception prefix: CodeCommit AWS CodeConnections Task state resource: arn:aws:states:::aws-sdk:codeconnections:[apiAction] Exception prefix: CodeConnections CodeDeploy Task state resource: arn:aws:states:::aws-sdk:codedeploy:[apiAction] Exception prefix: CodeDeploy Unsupported operations: BatchGetDeploymentInstances, GetDeploymentInstance, ListDeploymentInstances, SkipWaitTimeForInstanceTermination Supported service integrations 593 AWS Step Functions CodeGuru Profiler Developer Guide Task state resource: arn:aws:states:::aws-sdk:codeguruprofiler:[apiAction] Exception prefix: CodeGuruProfiler CodeGuru Reviewer Task state resource: arn:aws:states:::aws-sdk:codegurureviewer:[apiAction] Exception prefix: CodeGuruReviewer CodeGuru Security Task state resource: arn:aws:states:::aws-sdk:codegurusecurity:[apiAction] Exception prefix: CodeGuruSecurity CodePipeline Task state resource: arn:aws:states:::aws-sdk:codepipeline:[apiAction] Exception prefix: CodePipeline AWS CodeStar Connections Task state resource: arn:aws:states:::aws-sdk:codestarconnections:[apiAction] Exception prefix: CodeStarConnections AWS CodeStar Notifications Task state resource: arn:aws:states:::aws- sdk:codestarnotifications:[apiAction] Exception prefix: CodestarNotifications Cognito Identity Pools Task state resource: arn:aws:states:::aws-sdk:cognitoidentity:[apiAction] Exception prefix: CognitoIdentity Cognito Sync Task state resource: arn:aws:states:::aws-sdk:cognitosync:[apiAction] Exception prefix: CognitoSync Supported service integrations 594 AWS Step Functions Cognito User Pools Task state resource: arn:aws:states:::aws- sdk:cognitoidentityprovider:[apiAction] Exception prefix: CognitoIdentityProvider Amazon Comprehend Developer Guide Task state resource: arn:aws:states:::aws-sdk:comprehend:[apiAction] Exception prefix: Comprehend Amazon Comprehend Medical Task state resource: arn:aws:states:::aws-sdk:comprehendmedical:[apiAction] Exception prefix: ComprehendMedical Unsupported operations: DetectEntities Compute Optimizer Task state resource: arn:aws:states:::aws-sdk:computeoptimizer:[apiAction] Exception prefix: ComputeOptimizer AWS Config Task state resource: arn:aws:states:::aws-sdk:config:[apiAction] Exception prefix: Config Amazon Connect Task state resource: arn:aws:states:::aws-sdk:connect:[apiAction] Exception prefix: Connect Amazon Connect Campaigns Task state resource: arn:aws:states:::aws-sdk:connectcampaigns:[apiAction] Exception prefix: ConnectCampaigns Amazon Connect Campaigns V2 Task state resource: arn:aws:states:::aws-sdk:connectcampaignsv2:[apiAction] Supported service integrations 595 AWS Step Functions Developer Guide Exception prefix: ConnectCampaignsV2 Amazon Connect Cases Task state resource: arn:aws:states:::aws-sdk:connectcases:[apiAction] Exception prefix: ConnectCases Amazon Connect Contact Lens Task state resource: arn:aws:states:::aws-sdk:connectcontactlens:[apiAction] Exception prefix: ConnectContactLens Amazon Connect Customer Profiles Task state resource: arn:aws:states:::aws-sdk:customerprofiles:[apiAction] Exception prefix: CustomerProfiles Amazon Connect
|
step-functions-dg-181
|
step-functions-dg.pdf
| 181 |
state resource: arn:aws:states:::aws-sdk:comprehendmedical:[apiAction] Exception prefix: ComprehendMedical Unsupported operations: DetectEntities Compute Optimizer Task state resource: arn:aws:states:::aws-sdk:computeoptimizer:[apiAction] Exception prefix: ComputeOptimizer AWS Config Task state resource: arn:aws:states:::aws-sdk:config:[apiAction] Exception prefix: Config Amazon Connect Task state resource: arn:aws:states:::aws-sdk:connect:[apiAction] Exception prefix: Connect Amazon Connect Campaigns Task state resource: arn:aws:states:::aws-sdk:connectcampaigns:[apiAction] Exception prefix: ConnectCampaigns Amazon Connect Campaigns V2 Task state resource: arn:aws:states:::aws-sdk:connectcampaignsv2:[apiAction] Supported service integrations 595 AWS Step Functions Developer Guide Exception prefix: ConnectCampaignsV2 Amazon Connect Cases Task state resource: arn:aws:states:::aws-sdk:connectcases:[apiAction] Exception prefix: ConnectCases Amazon Connect Contact Lens Task state resource: arn:aws:states:::aws-sdk:connectcontactlens:[apiAction] Exception prefix: ConnectContactLens Amazon Connect Customer Profiles Task state resource: arn:aws:states:::aws-sdk:customerprofiles:[apiAction] Exception prefix: CustomerProfiles Amazon Connect Participant Task state resource: arn:aws:states:::aws-sdk:connectparticipant:[apiAction] Exception prefix: ConnectParticipant Amazon Connect Voice ID Task state resource: arn:aws:states:::aws-sdk:voiceid:[apiAction] Exception prefix: VoiceId Amazon Connect Wisdom Task state resource: arn:aws:states:::aws-sdk:wisdom:[apiAction] Exception prefix: Wisdom AWS Control Catalog Task state resource: arn:aws:states:::aws-sdk:controlcatalog:[apiAction] Exception prefix: ControlCatalog AWS Control Tower Task state resource: arn:aws:states:::aws-sdk:controltower:[apiAction] Exception prefix: ControlTower Supported service integrations 596 AWS Step Functions AWS Cost Explorer Developer Guide Task state resource: arn:aws:states:::aws-sdk:costexplorer:[apiAction] Exception prefix: CostExplorer Cost Optimization Hub Task state resource: arn:aws:states:::aws-sdk:costoptimizationhub:[apiAction] Exception prefix: CostOptimizationHub AWS Cost and Usage Report Task state resource: arn:aws:states:::aws-sdk:costandusagereport:[apiAction] Exception prefix: CostAndUsageReport Data Automation for Amazon Bedrock Task state resource: arn:aws:states:::aws- sdk:bedrockdataautomation:[apiAction] Exception prefix: BedrockDataAutomation AWS Data Exchange Task state resource: arn:aws:states:::aws-sdk:dataexchange:[apiAction] Exception prefix: DataExchange Unsupported operations: SendApiAsset AWS Data Exports Task state resource: arn:aws:states:::aws-sdk:bcmdataexports:[apiAction] Exception prefix: BcmDataExports Amazon Data Lifecycle Manager Task state resource: arn:aws:states:::aws-sdk:dlm:[apiAction] Exception prefix: Dlm Data Pipeline Task state resource: arn:aws:states:::aws-sdk:datapipeline:[apiAction] Supported service integrations 597 AWS Step Functions Developer Guide Exception prefix: DataPipeline DataSync Task state resource: arn:aws:states:::aws-sdk:datasync:[apiAction] Exception prefix: DataSync Amazon DataZone Task state resource: arn:aws:states:::aws-sdk:datazone:[apiAction] Exception prefix: DataZone AWS Database Migration Service Task state resource: arn:aws:states:::aws-sdk:databasemigration:[apiAction] Exception prefix: DatabaseMigration AWS Deadline Cloud Task state resource: arn:aws:states:::aws-sdk:deadline:[apiAction] Exception prefix: Deadline Detective Task state resource: arn:aws:states:::aws-sdk:detective:[apiAction] Exception prefix: Detective DevOps Guru Task state resource: arn:aws:states:::aws-sdk:devopsguru:[apiAction] Exception prefix: DevOpsGuru Device Farm Task state resource: arn:aws:states:::aws-sdk:devicefarm:[apiAction] Exception prefix: DeviceFarm Direct Connect Task state resource: arn:aws:states:::aws-sdk:directconnect:[apiAction] Supported service integrations 598 AWS Step Functions Developer Guide Exception prefix: DirectConnect Unsupported operations: AllocateConnectionOnInterconnect, DescribeConnectionLoa, DescribeConnectionsOnInterconnect, DescribeInterconnectLoa Directory Service Task state resource: arn:aws:states:::aws-sdk:directory:[apiAction] Exception prefix: Directory AWS Directory Service Data Task state resource: arn:aws:states:::aws-sdk:directoryservicedata:[apiAction] Exception prefix: DirectoryServiceData Amazon DocumentDB Task state resource: arn:aws:states:::aws-sdk:docdb:[apiAction] Exception prefix: DocDb Amazon DocumentDB Elastic Clusters Task state resource: arn:aws:states:::aws-sdk:docdbelastic:[apiAction] Exception prefix: DocDbElastic DynamoDB Task state resource: arn:aws:states:::aws-sdk:dynamodb:[apiAction] Exception prefix: DynamoDb DynamoDB Accelerator Task state resource: arn:aws:states:::aws-sdk:dax:[apiAction] Exception prefix: Dax DynamoDB Streams Task state resource: arn:aws:states:::aws-sdk:dynamodbstreams:[apiAction] Exception prefix: DynamoDbStreams Supported service integrations 599 AWS Step Functions Amazon EBS Developer Guide Task state resource: arn:aws:states:::aws-sdk:ebs:[apiAction] Exception prefix: Ebs Amazon EC2 Task state resource: arn:aws:states:::aws-sdk:ec2:[apiAction] Exception prefix: Ec2 EC2 Auto Scaling Task state resource: arn:aws:states:::aws-sdk:autoscaling:[apiAction] Exception prefix: AutoScaling EC2 Image Builder Task state resource: arn:aws:states:::aws-sdk:imagebuilder:[apiAction] Exception prefix: Imagebuilder AWS EC2 Instance Connect Task state resource: arn:aws:states:::aws-sdk:ec2instanceconnect:[apiAction] Exception prefix: Ec2InstanceConnect Amazon ECR Task state resource: arn:aws:states:::aws-sdk:ecr:[apiAction] Exception prefix: Ecr Amazon ECR Public Task state resource: arn:aws:states:::aws-sdk:ecrpublic:[apiAction] Exception prefix: EcrPublic Amazon ECS Task state resource: arn:aws:states:::aws-sdk:ecs:[apiAction] Exception prefix: Ecs Supported service integrations 600 AWS Step Functions Amazon EFS Developer Guide Task state resource: arn:aws:states:::aws-sdk:efs:[apiAction] Exception prefix: Efs Unsupported operations: CreateTags Amazon EKS Task state resource: arn:aws:states:::aws-sdk:eks:[apiAction] Exception prefix: Eks Amazon EKS Auth Task state resource: arn:aws:states:::aws-sdk:eksauth:[apiAction] Exception prefix: EksAuth Amazon EMR Task state resource: arn:aws:states:::aws-sdk:emr:[apiAction] Exception prefix: Emr Unsupported operations: DescribeJobFlows Amazon EMR Containers Task state resource: arn:aws:states:::aws-sdk:emrcontainers:[apiAction] Exception prefix: EmrContainers Amazon EMR Serverless Task state resource: arn:aws:states:::aws-sdk:emrserverless:[apiAction] Exception prefix: EmrServerless ElastiCache Task state resource: arn:aws:states:::aws-sdk:elasticache:[apiAction] Exception prefix: ElastiCache Elastic Beanstalk Task state resource: arn:aws:states:::aws-sdk:elasticbeanstalk:[apiAction] Supported service integrations 601 AWS Step Functions Developer Guide Exception prefix: ElasticBeanstalk Elastic Disaster Recovery Task state resource: arn:aws:states:::aws-sdk:drs:[apiAction] Exception prefix: Drs Elastic Inference Task state resource: arn:aws:states:::aws-sdk:elasticinference:[apiAction] Exception prefix: ElasticInference Elastic Load Balancing V1 Task state resource: arn:aws:states:::aws-sdk:elasticloadbalancing:[apiAction] Exception prefix: ElasticLoadBalancing Elastic Load Balancing V2 Task state resource: arn:aws:states:::aws- sdk:elasticloadbalancingv2:[apiAction] Exception prefix: ElasticLoadBalancingV2 Elastic Transcoder Task state resource: arn:aws:states:::aws-sdk:elastictranscoder:[apiAction] Exception prefix: ElasticTranscoder Unsupported operations: TestRole Amazon ElasticSearch Task state resource: arn:aws:states:::aws-sdk:elasticsearch:[apiAction] Exception prefix: Elasticsearch AWS End User Messaging Social Task state resource: arn:aws:states:::aws-sdk:socialmessaging:[apiAction] Exception prefix: SocialMessaging Supported service integrations 602 AWS Step Functions AWS Entity Resolution Developer Guide Task state resource: arn:aws:states:::aws-sdk:entityresolution:[apiAction] Exception prefix: EntityResolution Amazon EventBridge Task state resource: arn:aws:states:::aws-sdk:eventbridge:[apiAction] Exception prefix: EventBridge EventBridge Pipes Task state resource: arn:aws:states:::aws-sdk:pipes:[apiAction] Exception prefix: Pipes EventBridge Scheduler Task state resource: arn:aws:states:::aws-sdk:scheduler:[apiAction] Exception prefix: Scheduler EventBridge Schema Registry Task state resource: arn:aws:states:::aws-sdk:schemas:[apiAction] Exception prefix: Schemas Evidently Task state resource: arn:aws:states:::aws-sdk:evidently:[apiAction] Exception prefix: Evidently AWS FIS Task state resource: arn:aws:states:::aws-sdk:fis:[apiAction] Exception prefix: Fis Amazon FSx Task state resource: arn:aws:states:::aws-sdk:fsx:[apiAction] Exception prefix: FSx Supported service integrations 603 AWS Step Functions FinSpace Data Developer Guide Task state resource: arn:aws:states:::aws-sdk:finspacedata:[apiAction] Exception prefix: FinspaceData FinSpace Management Task state resource: arn:aws:states:::aws-sdk:finspace:[apiAction] Exception prefix: Finspace Firewall Manager Task state resource: arn:aws:states:::aws-sdk:fms:[apiAction] Exception prefix: Fms Amazon Forecast Task state resource: arn:aws:states:::aws-sdk:forecast:[apiAction] Exception prefix: Forecast Amazon Forecast Query Task state
|
step-functions-dg-182
|
step-functions-dg.pdf
| 182 |
resource: arn:aws:states:::aws-sdk:pipes:[apiAction] Exception prefix: Pipes EventBridge Scheduler Task state resource: arn:aws:states:::aws-sdk:scheduler:[apiAction] Exception prefix: Scheduler EventBridge Schema Registry Task state resource: arn:aws:states:::aws-sdk:schemas:[apiAction] Exception prefix: Schemas Evidently Task state resource: arn:aws:states:::aws-sdk:evidently:[apiAction] Exception prefix: Evidently AWS FIS Task state resource: arn:aws:states:::aws-sdk:fis:[apiAction] Exception prefix: Fis Amazon FSx Task state resource: arn:aws:states:::aws-sdk:fsx:[apiAction] Exception prefix: FSx Supported service integrations 603 AWS Step Functions FinSpace Data Developer Guide Task state resource: arn:aws:states:::aws-sdk:finspacedata:[apiAction] Exception prefix: FinspaceData FinSpace Management Task state resource: arn:aws:states:::aws-sdk:finspace:[apiAction] Exception prefix: Finspace Firewall Manager Task state resource: arn:aws:states:::aws-sdk:fms:[apiAction] Exception prefix: Fms Amazon Forecast Task state resource: arn:aws:states:::aws-sdk:forecast:[apiAction] Exception prefix: Forecast Amazon Forecast Query Task state resource: arn:aws:states:::aws-sdk:forecastquery:[apiAction] Exception prefix: Forecastquery Amazon Fraud Detector Task state resource: arn:aws:states:::aws-sdk:frauddetector:[apiAction] Exception prefix: FraudDetector AWS Free Tier Task state resource: arn:aws:states:::aws-sdk:freetier:[apiAction] Exception prefix: FreeTier Amazon GameLift Task state resource: arn:aws:states:::aws-sdk:gamelift:[apiAction] Exception prefix: GameLift Supported service integrations 604 AWS Step Functions AWS Glue Developer Guide Task state resource: arn:aws:states:::aws-sdk:glue:[apiAction] Exception prefix: Glue AWS Glue DataBrew Task state resource: arn:aws:states:::aws-sdk:databrew:[apiAction] Exception prefix: DataBrew AWS Ground Station Task state resource: arn:aws:states:::aws-sdk:groundstation:[apiAction] Exception prefix: GroundStation Amazon GuardDuty Task state resource: arn:aws:states:::aws-sdk:guardduty:[apiAction] Exception prefix: GuardDuty AWS Health Task state resource: arn:aws:states:::aws-sdk:health:[apiAction] Exception prefix: Health AWS Health Imaging Task state resource: arn:aws:states:::aws-sdk:medicalimaging:[apiAction] Exception prefix: MedicalImaging Amazon HealthLake Task state resource: arn:aws:states:::aws-sdk:healthlake:[apiAction] Exception prefix: HealthLake Amazon Honeycode Task state resource: arn:aws:states:::aws-sdk:honeycode:[apiAction] Exception prefix: Honeycode Supported service integrations 605 AWS Step Functions IAM Developer Guide Task state resource: arn:aws:states:::aws-sdk:iam:[apiAction] Exception prefix: Iam IAM Access Analyzer Task state resource: arn:aws:states:::aws-sdk:accessanalyzer:[apiAction] Exception prefix: AccessAnalyzer IAM Roles Anywhere Task state resource: arn:aws:states:::aws-sdk:rolesanywhere:[apiAction] Exception prefix: RolesAnywhere Amazon IVS Task state resource: arn:aws:states:::aws-sdk:ivs:[apiAction] Exception prefix: Ivs Amazon IVS Chat Task state resource: arn:aws:states:::aws-sdk:ivschat:[apiAction] Exception prefix: Ivschat Amazon IVS RealTime Task state resource: arn:aws:states:::aws-sdk:ivsrealtime:[apiAction] Exception prefix: IvsRealTime Incident Manager Task state resource: arn:aws:states:::aws-sdk:ssmincidents:[apiAction] Exception prefix: SsmIncidents Incident Manager Contacts Task state resource: arn:aws:states:::aws-sdk:ssmcontacts:[apiAction] Exception prefix: SsmContacts Supported service integrations 606 AWS Step Functions Amazon Inspector Scan Developer Guide Task state resource: arn:aws:states:::aws-sdk:inspectorscan:[apiAction] Exception prefix: InspectorScan Amazon Inspector V1 Task state resource: arn:aws:states:::aws-sdk:inspector:[apiAction] Exception prefix: Inspector Amazon Inspector V2 Task state resource: arn:aws:states:::aws-sdk:inspector2:[apiAction] Exception prefix: Inspector2 AWS Invoicing Task state resource: arn:aws:states:::aws-sdk:invoicing:[apiAction] Exception prefix: Invoicing AWS IoT Task state resource: arn:aws:states:::aws-sdk:iot:[apiAction] Exception prefix: Iot Unsupported operations: AttachPrincipalPolicy, ListPrincipalPolicies, DetachPrincipalPolicy, ListPolicyPrincipals, DetachPrincipalPolicy AWS IoT Analytics Task state resource: arn:aws:states:::aws-sdk:iotanalytics:[apiAction] Exception prefix: IoTAnalytics AWS IoT Device Advisor Task state resource: arn:aws:states:::aws-sdk:iotdeviceadvisor:[apiAction] Exception prefix: IotDeviceAdvisor Unsupported operations: ListTestCases Supported service integrations 607 AWS Step Functions AWS IoT Events Developer Guide Task state resource: arn:aws:states:::aws-sdk:iotevents:[apiAction] Exception prefix: IotEvents AWS IoT Events Data Task state resource: arn:aws:states:::aws-sdk:ioteventsdata:[apiAction] Exception prefix: IotEventsData AWS IoT Fleet Hub Task state resource: arn:aws:states:::aws-sdk:iotfleethub:[apiAction] Exception prefix: IoTFleetHub AWS IoT FleetWise Task state resource: arn:aws:states:::aws-sdk:iotfleetwise:[apiAction] Exception prefix: IoTFleetWise AWS IoT Greengrass V1 Task state resource: arn:aws:states:::aws-sdk:greengrass:[apiAction] Exception prefix: Greengrass AWS IoT Greengrass V2 Task state resource: arn:aws:states:::aws-sdk:greengrassv2:[apiAction] Exception prefix: GreengrassV2 AWS IoT Jobs Data Task state resource: arn:aws:states:::aws-sdk:iotjobsdataplane:[apiAction] Exception prefix: IotJobsDataPlane AWS IoT Secure Tunneling Task state resource: arn:aws:states:::aws-sdk:iotsecuretunneling:[apiAction] Exception prefix: IoTSecureTunneling Supported service integrations 608 AWS Step Functions AWS IoT SiteWise Developer Guide Task state resource: arn:aws:states:::aws-sdk:iotsitewise:[apiAction] Exception prefix: IoTSiteWise Unsupported operations: InvokeAssistant AWS IoT Things Graph Task state resource: arn:aws:states:::aws-sdk:iotthingsgraph:[apiAction] Exception prefix: IoTThingsGraph AWS IoT TwinMaker Task state resource: arn:aws:states:::aws-sdk:iottwinmaker:[apiAction] Exception prefix: IoTTwinMaker AWS IoT Wireless Task state resource: arn:aws:states:::aws-sdk:iotwireless:[apiAction] Exception prefix: IotWireless AWS KMS Task state resource: arn:aws:states:::aws-sdk:kms:[apiAction] Exception prefix: Kms Amazon Kendra Task state resource: arn:aws:states:::aws-sdk:kendra:[apiAction] Exception prefix: Kendra Amazon Kendra Intelligent Ranking Task state resource: arn:aws:states:::aws-sdk:kendraranking:[apiAction] Exception prefix: KendraRanking Amazon Keyspaces Task state resource: arn:aws:states:::aws-sdk:keyspaces:[apiAction] Supported service integrations 609 AWS Step Functions Exception prefix: Keyspaces Kinesis Data Analytics V1 Developer Guide Task state resource: arn:aws:states:::aws-sdk:kinesisanalytics:[apiAction] Exception prefix: KinesisAnalytics Kinesis Data Analytics V2 Task state resource: arn:aws:states:::aws-sdk:kinesisanalyticsv2:[apiAction] Exception prefix: KinesisAnalyticsV2 Kinesis Data Firehose Task state resource: arn:aws:states:::aws-sdk:firehose:[apiAction] Exception prefix: Firehose Kinesis Data Streams Task state resource: arn:aws:states:::aws-sdk:kinesis:[apiAction] Exception prefix: Kinesis Unsupported operations: SubscribeToShard Kinesis Video Signaling Channels Task state resource: arn:aws:states:::aws- sdk:kinesisvideosignaling:[apiAction] Exception prefix: KinesisVideoSignaling Kinesis Video Streams Task state resource: arn:aws:states:::aws-sdk:kinesisvideo:[apiAction] Exception prefix: KinesisVideo Kinesis Video Streams Archived Media Task state resource: arn:aws:states:::aws- sdk:kinesisvideoarchivedmedia:[apiAction] Exception prefix: KinesisVideoArchivedMedia Supported service integrations 610 AWS Step Functions Kinesis Video Streams Media Developer Guide Task state resource: arn:aws:states:::aws-sdk:kinesisvideomedia:[apiAction] Exception prefix: KinesisVideoMedia Kinesis Video WebRTC Storage Task state resource: arn:aws:states:::aws- sdk:kinesisvideowebrtcstorage:[apiAction] Exception prefix: KinesisVideoWebRtcStorage AWS Lake Formation Task state resource: arn:aws:states:::aws-sdk:lakeformation:[apiAction] Exception prefix: LakeFormation AWS Lambda Task state resource: arn:aws:states:::aws-sdk:lambda:[apiAction] Exception prefix: Lambda Unsupported operations: InvokeAsync, InvokeWithResponseStream AWS Launch Wizard Task state resource: arn:aws:states:::aws-sdk:launchwizard:[apiAction] Exception prefix: LaunchWizard Amazon Lex Model Building V1 Task state resource: arn:aws:states:::aws-sdk:lexmodelbuilding:[apiAction] Exception prefix: LexModelBuilding Amazon Lex Model Building V2 Task state resource: arn:aws:states:::aws-sdk:lexmodelsv2:[apiAction] Exception prefix: LexModelsV2 Amazon Lex Runtime V1 Task state resource: arn:aws:states:::aws-sdk:lexruntime:[apiAction] Supported service integrations 611 AWS Step Functions Developer Guide Exception prefix: LexRuntime Amazon Lex Runtime V2 Task state resource: arn:aws:states:::aws-sdk:lexruntimev2:[apiAction] Exception prefix: LexRuntimeV2 Unsupported operations: StartConversation AWS License Manager Task state resource: arn:aws:states:::aws-sdk:licensemanager:[apiAction] Exception prefix: LicenseManager License
|
step-functions-dg-183
|
step-functions-dg.pdf
| 183 |
Formation Task state resource: arn:aws:states:::aws-sdk:lakeformation:[apiAction] Exception prefix: LakeFormation AWS Lambda Task state resource: arn:aws:states:::aws-sdk:lambda:[apiAction] Exception prefix: Lambda Unsupported operations: InvokeAsync, InvokeWithResponseStream AWS Launch Wizard Task state resource: arn:aws:states:::aws-sdk:launchwizard:[apiAction] Exception prefix: LaunchWizard Amazon Lex Model Building V1 Task state resource: arn:aws:states:::aws-sdk:lexmodelbuilding:[apiAction] Exception prefix: LexModelBuilding Amazon Lex Model Building V2 Task state resource: arn:aws:states:::aws-sdk:lexmodelsv2:[apiAction] Exception prefix: LexModelsV2 Amazon Lex Runtime V1 Task state resource: arn:aws:states:::aws-sdk:lexruntime:[apiAction] Supported service integrations 611 AWS Step Functions Developer Guide Exception prefix: LexRuntime Amazon Lex Runtime V2 Task state resource: arn:aws:states:::aws-sdk:lexruntimev2:[apiAction] Exception prefix: LexRuntimeV2 Unsupported operations: StartConversation AWS License Manager Task state resource: arn:aws:states:::aws-sdk:licensemanager:[apiAction] Exception prefix: LicenseManager License Manager Linux Subscriptions Task state resource: arn:aws:states:::aws- sdk:licensemanagerlinuxsubscriptions:[apiAction] Exception prefix: LicenseManagerLinuxSubscriptions License Manager User Subscriptions Task state resource: arn:aws:states:::aws- sdk:licensemanagerusersubscriptions:[apiAction] Exception prefix: LicenseManagerUserSubscriptions Amazon Lightsail Task state resource: arn:aws:states:::aws-sdk:lightsail:[apiAction] Exception prefix: Lightsail Amazon Location Task state resource: arn:aws:states:::aws-sdk:location:[apiAction] Exception prefix: Location Amazon Location Service Maps V2 Task state resource: arn:aws:states:::aws-sdk:geomaps:[apiAction] Exception prefix: GeoMaps Supported service integrations 612 AWS Step Functions Developer Guide Amazon Location Service Places V2 Task state resource: arn:aws:states:::aws-sdk:geoplaces:[apiAction] Exception prefix: GeoPlaces Amazon Location Service Routes V2 Task state resource: arn:aws:states:::aws-sdk:georoutes:[apiAction] Exception prefix: GeoRoutes Lookout for Equipment Task state resource: arn:aws:states:::aws-sdk:lookoutequipment:[apiAction] Exception prefix: LookoutEquipment Lookout for Metrics Task state resource: arn:aws:states:::aws-sdk:lookoutmetrics:[apiAction] Exception prefix: LookoutMetrics Lookout for Vision Task state resource: arn:aws:states:::aws-sdk:lookoutvision:[apiAction] Exception prefix: LookoutVision Amazon MQ Task state resource: arn:aws:states:::aws-sdk:mq:[apiAction] Exception prefix: Mq Amazon MSK Task state resource: arn:aws:states:::aws-sdk:kafka:[apiAction] Exception prefix: Kafka Amazon MSK Connect Task state resource: arn:aws:states:::aws-sdk:kafkaconnect:[apiAction] Exception prefix: KafkaConnect Supported service integrations 613 AWS Step Functions Amazon MWAA Developer Guide Task state resource: arn:aws:states:::aws-sdk:mwaa:[apiAction] Exception prefix: Mwaa Amazon Macie V2 Task state resource: arn:aws:states:::aws-sdk:macie2:[apiAction] Exception prefix: Macie2 MailManager Task state resource: arn:aws:states:::aws-sdk:mailmanager:[apiAction] Exception prefix: MailManager AWS Mainframe Modernization Task state resource: arn:aws:states:::aws-sdk:m2:[apiAction] Exception prefix: M2 AWS Mainframe Modernization Application Testing Task state resource: arn:aws:states:::aws-sdk:apptest:[apiAction] Exception prefix: AppTest Managed Blockchain Task state resource: arn:aws:states:::aws-sdk:managedblockchain:[apiAction] Exception prefix: ManagedBlockchain Managed Blockchain Query Task state resource: arn:aws:states:::aws- sdk:managedblockchainquery:[apiAction] Exception prefix: ManagedBlockchainQuery Amazon Managed Grafana Task state resource: arn:aws:states:::aws-sdk:grafana:[apiAction] Exception prefix: Grafana Supported service integrations 614 AWS Step Functions AWS Marketplace Catalog Developer Guide Task state resource: arn:aws:states:::aws-sdk:marketplacecatalog:[apiAction] Exception prefix: MarketplaceCatalog AWS Marketplace Commerce Analytics Task state resource: arn:aws:states:::aws- sdk:marketplacecommerceanalytics:[apiAction] Exception prefix: MarketplaceCommerceAnalytics AWS Marketplace Entitlement Service Task state resource: arn:aws:states:::aws- sdk:marketplaceentitlement:[apiAction] Exception prefix: MarketplaceEntitlement AWS Marketplace Metering Task state resource: arn:aws:states:::aws-sdk:marketplacemetering:[apiAction] Exception prefix: MarketplaceMetering AWS Marketplace Reporting Service Task state resource: arn:aws:states:::aws-sdk:marketplacereporting:[apiAction] Exception prefix: MarketplaceReporting Amazon Mechanical Turk Task state resource: arn:aws:states:::aws-sdk:mturk:[apiAction] Exception prefix: MTurk MediaConnect Task state resource: arn:aws:states:::aws-sdk:mediaconnect:[apiAction] Exception prefix: MediaConnect MediaConvert Task state resource: arn:aws:states:::aws-sdk:mediaconvert:[apiAction] Supported service integrations 615 AWS Step Functions Developer Guide Exception prefix: MediaConvert MediaLive Task state resource: arn:aws:states:::aws-sdk:medialive:[apiAction] Exception prefix: MediaLive MediaPackage V1 Task state resource: arn:aws:states:::aws-sdk:mediapackage:[apiAction] Exception prefix: MediaPackage Unsupported operations: RotateChannelCredentials MediaPackage V2 Task state resource: arn:aws:states:::aws-sdk:mediapackagev2:[apiAction] Exception prefix: MediaPackageV2 MediaPackage VOD Task state resource: arn:aws:states:::aws-sdk:mediapackagevod:[apiAction] Exception prefix: MediaPackageVod MediaStore Task state resource: arn:aws:states:::aws-sdk:mediastore:[apiAction] Exception prefix: MediaStore MediaTailor Task state resource: arn:aws:states:::aws-sdk:mediatailor:[apiAction] Exception prefix: MediaTailor Amazon MemoryDB Task state resource: arn:aws:states:::aws-sdk:memorydb:[apiAction] Exception prefix: MemoryDb Migration Hub Task state resource: arn:aws:states:::aws-sdk:migrationhub:[apiAction] Supported service integrations 616 AWS Step Functions Developer Guide Exception prefix: MigrationHub Migration Hub Home Region Task state resource: arn:aws:states:::aws-sdk:migrationhubconfig:[apiAction] Exception prefix: MigrationHubConfig Migration Hub Orchestrator Task state resource: arn:aws:states:::aws- sdk:migrationhuborchestrator:[apiAction] Exception prefix: MigrationHubOrchestrator Migration Hub Refactor Spaces Task state resource: arn:aws:states:::aws- sdk:migrationhubrefactorspaces:[apiAction] Exception prefix: MigrationHubRefactorSpaces Migration Hub Strategy Recommendations Task state resource: arn:aws:states:::aws-sdk:migrationhubstrategy:[apiAction] Exception prefix: MigrationHubStrategy Amazon Neptune Task state resource: arn:aws:states:::aws-sdk:neptune:[apiAction] Exception prefix: Neptune Amazon Neptune Graph Task state resource: arn:aws:states:::aws-sdk:neptunegraph:[apiAction] Exception prefix: NeptuneGraph Network Firewall Task state resource: arn:aws:states:::aws-sdk:networkfirewall:[apiAction] Exception prefix: NetworkFirewall Network Flow Monitor Task state resource: arn:aws:states:::aws-sdk:networkflowmonitor:[apiAction] Supported service integrations 617 AWS Step Functions Developer Guide Exception prefix: NetworkFlowMonitor Network Manager Task state resource: arn:aws:states:::aws-sdk:networkmanager:[apiAction] Exception prefix: NetworkManager Network Monitor Task state resource: arn:aws:states:::aws-sdk:networkmonitor:[apiAction] Exception prefix: NetworkMonitor Amazon Omics Task state resource: arn:aws:states:::aws-sdk:omics:[apiAction] Exception prefix: Omics Amazon OpenSearch Task state resource: arn:aws:states:::aws-sdk:opensearch:[apiAction] Exception prefix: OpenSearch Amazon OpenSearch Ingestion Task state resource: arn:aws:states:::aws-sdk:osis:[apiAction] Exception prefix: Osis OpenSearch Serverless Task state resource: arn:aws:states:::aws-sdk:opensearchserverless:[apiAction] Exception prefix: OpenSearchServerless OpsWorks Task state resource: arn:aws:states:::aws-sdk:opsworks:[apiAction] Exception prefix: OpsWorks OpsWorks CM Task state resource: arn:aws:states:::aws-sdk:opsworkscm:[apiAction] Exception prefix: OpsWorksCm Supported service integrations 618 AWS Step Functions AWS Organizations Developer Guide Task state resource: arn:aws:states:::aws-sdk:organizations:[apiAction] Exception prefix: Organizations AWS Outposts Task state resource: arn:aws:states:::aws-sdk:outposts:[apiAction] Exception prefix: Outposts AWS Panorama Task state resource: arn:aws:states:::aws-sdk:panorama:[apiAction] Exception prefix: Panorama AWS Parallel Computing Service Task state resource: arn:aws:states:::aws-sdk:pcs:[apiAction] Exception prefix: Pcs Partner Central Selling API Task state resource: arn:aws:states:::aws- sdk:partnercentralselling:[apiAction] Exception prefix: PartnerCentralSelling Payment Cryptography Task state resource: arn:aws:states:::aws-sdk:paymentcryptography:[apiAction] Exception prefix: PaymentCryptography Payment Cryptography Data Task state resource: arn:aws:states:::aws- sdk:paymentcryptographydata:[apiAction] Exception prefix: PaymentCryptographyData Amazon Personalize Task state resource: arn:aws:states:::aws-sdk:personalize:[apiAction] Supported service integrations 619 AWS Step Functions Developer Guide Exception prefix: Personalize Amazon Personalize Events Task state resource: arn:aws:states:::aws-sdk:personalizeevents:[apiAction] Exception prefix: PersonalizeEvents Amazon Personalize Runtime Task state resource: arn:aws:states:::aws-sdk:personalizeruntime:[apiAction] Exception prefix: PersonalizeRuntime Amazon Pinpoint Task state resource: arn:aws:states:::aws-sdk:pinpoint:[apiAction] Exception
|
step-functions-dg-184
|
step-functions-dg.pdf
| 184 |
Exception prefix: Outposts AWS Panorama Task state resource: arn:aws:states:::aws-sdk:panorama:[apiAction] Exception prefix: Panorama AWS Parallel Computing Service Task state resource: arn:aws:states:::aws-sdk:pcs:[apiAction] Exception prefix: Pcs Partner Central Selling API Task state resource: arn:aws:states:::aws- sdk:partnercentralselling:[apiAction] Exception prefix: PartnerCentralSelling Payment Cryptography Task state resource: arn:aws:states:::aws-sdk:paymentcryptography:[apiAction] Exception prefix: PaymentCryptography Payment Cryptography Data Task state resource: arn:aws:states:::aws- sdk:paymentcryptographydata:[apiAction] Exception prefix: PaymentCryptographyData Amazon Personalize Task state resource: arn:aws:states:::aws-sdk:personalize:[apiAction] Supported service integrations 619 AWS Step Functions Developer Guide Exception prefix: Personalize Amazon Personalize Events Task state resource: arn:aws:states:::aws-sdk:personalizeevents:[apiAction] Exception prefix: PersonalizeEvents Amazon Personalize Runtime Task state resource: arn:aws:states:::aws-sdk:personalizeruntime:[apiAction] Exception prefix: PersonalizeRuntime Amazon Pinpoint Task state resource: arn:aws:states:::aws-sdk:pinpoint:[apiAction] Exception prefix: Pinpoint Amazon Pinpoint Email Service Task state resource: arn:aws:states:::aws-sdk:pinpointemail:[apiAction] Exception prefix: PinpointEmail Amazon Pinpoint SMS and Voice V1 Task state resource: arn:aws:states:::aws-sdk:pinpointsmsvoice:[apiAction] Exception prefix: PinpointSmsVoice Amazon Pinpoint SMS and Voice V2 Task state resource: arn:aws:states:::aws-sdk:pinpointsmsvoicev2:[apiAction] Exception prefix: PinpointSmsVoiceV2 Amazon Polly Task state resource: arn:aws:states:::aws-sdk:polly:[apiAction] Exception prefix: Polly AWS Price List Task state resource: arn:aws:states:::aws-sdk:pricing:[apiAction] Exception prefix: Pricing Supported service integrations 620 AWS Step Functions AWS Private 5G Developer Guide Task state resource: arn:aws:states:::aws-sdk:privatenetworks:[apiAction] Exception prefix: PrivateNetworks Private CA Connector for Active Directory Task state resource: arn:aws:states:::aws-sdk:pcaconnectorad:[apiAction] Exception prefix: PcaConnectorAd Private CA Connector for SCEP Task state resource: arn:aws:states:::aws-sdk:pcaconnectorscep:[apiAction] Exception prefix: PcaConnectorScep Amazon Prometheus Task state resource: arn:aws:states:::aws-sdk:amp:[apiAction] Exception prefix: Amp AWS Proton Task state resource: arn:aws:states:::aws-sdk:proton:[apiAction] Exception prefix: Proton Amazon Q Apps Task state resource: arn:aws:states:::aws-sdk:qapps:[apiAction] Exception prefix: QApps Amazon Q Business Task state resource: arn:aws:states:::aws-sdk:qbusiness:[apiAction] Exception prefix: QBusiness Unsupported operations: Chat Amazon Q Connect Task state resource: arn:aws:states:::aws-sdk:qconnect:[apiAction] Supported service integrations 621 AWS Step Functions Exception prefix: QConnect Amazon QLDB Developer Guide Task state resource: arn:aws:states:::aws-sdk:qldb:[apiAction] Exception prefix: Qldb Amazon QLDB Session Task state resource: arn:aws:states:::aws-sdk:qldbsession:[apiAction] Exception prefix: QldbSession Amazon QuickSight Task state resource: arn:aws:states:::aws-sdk:quicksight:[apiAction] Exception prefix: QuickSight Amazon RDS Task state resource: arn:aws:states:::aws-sdk:rds:[apiAction] Exception prefix: Rds Amazon RDS Data Task state resource: arn:aws:states:::aws-sdk:rdsdata:[apiAction] Exception prefix: RdsData Unsupported operations: ExecuteSql Amazon RDS Performance Insights Task state resource: arn:aws:states:::aws-sdk:pi:[apiAction] Exception prefix: Pi Recycle Bin for EBS Task state resource: arn:aws:states:::aws-sdk:rbin:[apiAction] Exception prefix: Rbin Amazon Redshift Task state resource: arn:aws:states:::aws-sdk:redshift:[apiAction] Supported service integrations 622 AWS Step Functions Exception prefix: Redshift Amazon Redshift Data Developer Guide Task state resource: arn:aws:states:::aws-sdk:redshiftdata:[apiAction] Exception prefix: RedshiftData Amazon Redshift Serverless Task state resource: arn:aws:states:::aws-sdk:redshiftserverless:[apiAction] Exception prefix: RedshiftServerless Amazon Rekognition Task state resource: arn:aws:states:::aws-sdk:rekognition:[apiAction] Exception prefix: Rekognition Resilience Hub Task state resource: arn:aws:states:::aws-sdk:resiliencehub:[apiAction] Exception prefix: Resiliencehub AWS Resource Access Manager Task state resource: arn:aws:states:::aws-sdk:ram:[apiAction] Exception prefix: Ram AWS Resource Explorer Task state resource: arn:aws:states:::aws-sdk:resourceexplorer2:[apiAction] Exception prefix: ResourceExplorer2 Resource Groups Task state resource: arn:aws:states:::aws-sdk:resourcegroups:[apiAction] Exception prefix: ResourceGroups Resource Groups Tagging Task state resource: arn:aws:states:::aws- sdk:resourcegroupstaggingapi:[apiAction] Supported service integrations 623 AWS Step Functions Developer Guide Exception prefix: ResourceGroupsTaggingApi AWS RoboMaker Task state resource: arn:aws:states:::aws-sdk:robomaker:[apiAction] Exception prefix: RoboMaker Route 53 Task state resource: arn:aws:states:::aws-sdk:route53:[apiAction] Exception prefix: Route53 Route 53 ARC Zonal Shift Task state resource: arn:aws:states:::aws-sdk:arczonalshift:[apiAction] Exception prefix: ArcZonalShift Route 53 Domains Task state resource: arn:aws:states:::aws-sdk:route53domains:[apiAction] Exception prefix: Route53Domains Route 53 Profiles Task state resource: arn:aws:states:::aws-sdk:route53profiles:[apiAction] Exception prefix: Route53Profiles Route 53 Recovery Control Config Task state resource: arn:aws:states:::aws- sdk:route53recoverycontrolconfig:[apiAction] Exception prefix: Route53RecoveryControlConfig Route 53 Recovery Readiness Task state resource: arn:aws:states:::aws- sdk:route53recoveryreadiness:[apiAction] Exception prefix: Route53RecoveryReadiness Route 53 Resolver Task state resource: arn:aws:states:::aws-sdk:route53resolver:[apiAction] Supported service integrations 624 AWS Step Functions Developer Guide Exception prefix: Route53Resolver Route 53 Routing Control Task state resource: arn:aws:states:::aws- sdk:route53recoverycluster:[apiAction] Exception prefix: Route53RecoveryCluster Runtime for Amazon Bedrock Data Automation Task state resource: arn:aws:states:::aws- sdk:bedrockdataautomationruntime:[apiAction] Exception prefix: BedrockDataAutomationRuntime Amazon S3 Task state resource: arn:aws:states:::aws-sdk:s3:[apiAction] Exception prefix: S3 Unsupported operations: SelectObjectContent Amazon S3 Control Task state resource: arn:aws:states:::aws-sdk:s3control:[apiAction] Exception prefix: S3Control Unsupported operations: SelectObjectContent Amazon S3 Glacier Task state resource: arn:aws:states:::aws-sdk:glacier:[apiAction] Exception prefix: Glacier Amazon S3 Tables Task state resource: arn:aws:states:::aws-sdk:s3tables:[apiAction] Exception prefix: S3Tables Amazon S3 on Outposts Task state resource: arn:aws:states:::aws-sdk:s3outposts:[apiAction] Supported service integrations 625 AWS Step Functions Developer Guide Exception prefix: S3Outposts Amazon SES V1 Task state resource: arn:aws:states:::aws-sdk:ses:[apiAction] Exception prefix: Ses Amazon SES V2 Task state resource: arn:aws:states:::aws-sdk:sesv2:[apiAction] Exception prefix: SesV2 Amazon SNS Task state resource: arn:aws:states:::aws-sdk:sns:[apiAction] Exception prefix: Sns Amazon SQS Task state resource: arn:aws:states:::aws-sdk:sqs:[apiAction] Exception prefix: Sqs AWS SSO Task state resource: arn:aws:states:::aws-sdk:sso:[apiAction] Exception prefix: Sso AWS SSO Task state resource: arn:aws:states:::aws-sdk:identitystore:[apiAction] Exception prefix: Identitystore AWS SSO Admin Task state resource: arn:aws:states:::aws-sdk:ssoadmin:[apiAction] Exception prefix: SsoAdmin AWS SSO OIDC Task state resource: arn:aws:states:::aws-sdk:ssooidc:[apiAction] Supported service integrations 626 AWS Step Functions Exception prefix: SsoOidc Amazon SWF Developer Guide Task state resource: arn:aws:states:::aws-sdk:swf:[apiAction] Exception prefix: Swf SageMaker Task state resource: arn:aws:states:::aws-sdk:sagemaker:[apiAction] Exception prefix: SageMaker SageMaker Edge Manager Task state resource: arn:aws:states:::aws-sdk:sagemakeredge:[apiAction] Exception prefix: SagemakerEdge SageMaker Feature Store Task state resource: arn:aws:states:::aws- sdk:sagemakerfeaturestoreruntime:[apiAction] Exception prefix: SageMakerFeatureStoreRuntime SageMaker Geospatial Task state resource: arn:aws:states:::aws-sdk:sagemakergeospatial:[apiAction] Exception prefix: SageMakerGeospatial SageMaker Metrics Task state resource: arn:aws:states:::aws-sdk:sagemakermetrics:[apiAction] Exception prefix: SageMakerMetrics SageMaker Runtime Task state resource: arn:aws:states:::aws-sdk:sagemakerruntime:[apiAction] Exception prefix: SageMakerRuntime Unsupported operations: InvokeEndpointWithResponseStream Supported service integrations 627 AWS Step Functions AWS Savings Plans Developer Guide Task state resource: arn:aws:states:::aws-sdk:savingsplans:[apiAction] Exception prefix: Savingsplans AWS Secrets Manager
|
step-functions-dg-185
|
step-functions-dg.pdf
| 185 |
integrations 626 AWS Step Functions Exception prefix: SsoOidc Amazon SWF Developer Guide Task state resource: arn:aws:states:::aws-sdk:swf:[apiAction] Exception prefix: Swf SageMaker Task state resource: arn:aws:states:::aws-sdk:sagemaker:[apiAction] Exception prefix: SageMaker SageMaker Edge Manager Task state resource: arn:aws:states:::aws-sdk:sagemakeredge:[apiAction] Exception prefix: SagemakerEdge SageMaker Feature Store Task state resource: arn:aws:states:::aws- sdk:sagemakerfeaturestoreruntime:[apiAction] Exception prefix: SageMakerFeatureStoreRuntime SageMaker Geospatial Task state resource: arn:aws:states:::aws-sdk:sagemakergeospatial:[apiAction] Exception prefix: SageMakerGeospatial SageMaker Metrics Task state resource: arn:aws:states:::aws-sdk:sagemakermetrics:[apiAction] Exception prefix: SageMakerMetrics SageMaker Runtime Task state resource: arn:aws:states:::aws-sdk:sagemakerruntime:[apiAction] Exception prefix: SageMakerRuntime Unsupported operations: InvokeEndpointWithResponseStream Supported service integrations 627 AWS Step Functions AWS Savings Plans Developer Guide Task state resource: arn:aws:states:::aws-sdk:savingsplans:[apiAction] Exception prefix: Savingsplans AWS Secrets Manager Task state resource: arn:aws:states:::aws-sdk:secretsmanager:[apiAction] Exception prefix: SecretsManager AWS Security Hub Task state resource: arn:aws:states:::aws-sdk:securityhub:[apiAction] Exception prefix: SecurityHub Security Incident Response Task state resource: arn:aws:states:::aws-sdk:securityir:[apiAction] Exception prefix: SecurityIr Amazon Security Lake Task state resource: arn:aws:states:::aws-sdk:securitylake:[apiAction] Exception prefix: SecurityLake Unsupported operations: GetDatalake, GetDatalakeAutoEnable, GetDatalakeExceptionsExpiry, GetDatalakeExceptionsSubscription, GetDatalakeStatus, CreateSubscriptionNotificationConfiguration, CreateDatalake, CreateDatalakeAutoEnable, CreateDatalakeDelegatedAdmin, CreateDatalakeExceptionsSubscription, DeleteDatalake, UpdateDatalake, UpdateSubscriptionNotificationConfiguration, UpdateDatalakeExceptionsExpiry, UpdateDatalakeExceptionsSubscription, DeleteDatalakeAutoEnable, DeleteDatalakeDelegatedAdmin, DeleteDatalakeExceptionsSubscription, DeleteSubscriptionNotificationConfiguration, ListDatalakeExceptions AWS Security Token Service Task state resource: arn:aws:states:::aws-sdk:sts:[apiAction] Supported service integrations 628 AWS Step Functions Exception prefix: Sts Developer Guide Unsupported operations: AssumeRole, AssumeRoleWithSAML, AssumeRoleWithWebIdentity AWS Server Migration Service Task state resource: arn:aws:states:::aws-sdk:sms:[apiAction] Exception prefix: Sms AWS Serverless Application Repository Task state resource: arn:aws:states:::aws- sdk:serverlessapplicationrepository:[apiAction] Exception prefix: ServerlessApplicationRepository AWS Service Catalog Task state resource: arn:aws:states:::aws-sdk:servicecatalog:[apiAction] Exception prefix: ServiceCatalog AWS Service Catalog App Registry Task state resource: arn:aws:states:::aws- sdk:servicecatalogappregistry:[apiAction] Exception prefix: ServiceCatalogAppRegistry Service Quotas Task state resource: arn:aws:states:::aws-sdk:servicequotas:[apiAction] Exception prefix: ServiceQuotas AWS Shield Task state resource: arn:aws:states:::aws-sdk:shield:[apiAction] Exception prefix: Shield Unsupported operations: DeleteSubscription AWS Signer Task state resource: arn:aws:states:::aws-sdk:signer:[apiAction] Supported service integrations 629 AWS Step Functions Exception prefix: Signer AWS SimSpace Weaver Developer Guide Task state resource: arn:aws:states:::aws-sdk:simspaceweaver:[apiAction] Exception prefix: SimSpaceWeaver AWS Snow Device Management Task state resource: arn:aws:states:::aws-sdk:snowdevicemanagement:[apiAction] Exception prefix: SnowDeviceManagement AWS Snowball Task state resource: arn:aws:states:::aws-sdk:snowball:[apiAction] Exception prefix: Snowball AWS Step Functions Task state resource: arn:aws:states:::aws-sdk:sfn:[apiAction] Exception prefix: Sfn AWS Storage Gateway Task state resource: arn:aws:states:::aws-sdk:storagegateway:[apiAction] Exception prefix: StorageGateway AWS Supply Chain Task state resource: arn:aws:states:::aws-sdk:supplychain:[apiAction] Exception prefix: SupplyChain AWS Support Task state resource: arn:aws:states:::aws-sdk:support:[apiAction] Exception prefix: Support AWS Support App Task state resource: arn:aws:states:::aws-sdk:supportapp:[apiAction] Exception prefix: SupportApp Supported service integrations 630 AWS Step Functions Systems Manager Developer Guide Task state resource: arn:aws:states:::aws-sdk:ssm:[apiAction] Exception prefix: Ssm AWS Systems Manager QuickSetup Task state resource: arn:aws:states:::aws-sdk:ssmquicksetup:[apiAction] Exception prefix: SsmQuickSetup Systems Manager for SAP Task state resource: arn:aws:states:::aws-sdk:ssmsap:[apiAction] Exception prefix: SsmSap Tax Settings Task state resource: arn:aws:states:::aws-sdk:taxsettings:[apiAction] Exception prefix: TaxSettings AWS Telco Network Builder Task state resource: arn:aws:states:::aws-sdk:tnb:[apiAction] Exception prefix: Tnb Amazon Textract Task state resource: arn:aws:states:::aws-sdk:textract:[apiAction] Exception prefix: Textract Timestream InfluxDB Task state resource: arn:aws:states:::aws-sdk:timestreaminfluxdb:[apiAction] Exception prefix: TimestreamInfluxDb Amazon Timestream Query Task state resource: arn:aws:states:::aws-sdk:timestreamquery:[apiAction] Exception prefix: TimestreamQuery Supported service integrations 631 AWS Step Functions Amazon Timestream Write Developer Guide Task state resource: arn:aws:states:::aws-sdk:timestreamwrite:[apiAction] Exception prefix: TimestreamWrite Amazon Transcribe Task state resource: arn:aws:states:::aws-sdk:transcribe:[apiAction] Exception prefix: Transcribe AWS Transfer Family Task state resource: arn:aws:states:::aws-sdk:transfer:[apiAction] Exception prefix: Transfer Amazon Translate Task state resource: arn:aws:states:::aws-sdk:translate:[apiAction] Exception prefix: Translate Trusted Advisor Task state resource: arn:aws:states:::aws-sdk:trustedadvisor:[apiAction] Exception prefix: TrustedAdvisor AWS User Notifications Contacts Task state resource: arn:aws:states:::aws- sdk:notificationscontacts:[apiAction] Exception prefix: NotificationsContacts Amazon VPC Lattice Task state resource: arn:aws:states:::aws-sdk:vpclattice:[apiAction] Exception prefix: VpcLattice Verified Permissions Task state resource: arn:aws:states:::aws-sdk:verifiedpermissions:[apiAction] Exception prefix: VerifiedPermissions Supported service integrations 632 AWS Step Functions AWS WAF V1 Developer Guide Task state resource: arn:aws:states:::aws-sdk:waf:[apiAction] Exception prefix: Waf AWS WAF V1 Regional Task state resource: arn:aws:states:::aws-sdk:wafregional:[apiAction] Exception prefix: WafRegional AWS WAF V2 Task state resource: arn:aws:states:::aws-sdk:wafv2:[apiAction] Exception prefix: Wafv2 AWS Well-Architected Tool Task state resource: arn:aws:states:::aws-sdk:wellarchitected:[apiAction] Exception prefix: WellArchitected Amazon WorkDocs Task state resource: arn:aws:states:::aws-sdk:workdocs:[apiAction] Exception prefix: WorkDocs Amazon WorkMail Task state resource: arn:aws:states:::aws-sdk:workmail:[apiAction] Exception prefix: WorkMail Amazon WorkMail Message Flow Task state resource: arn:aws:states:::aws-sdk:workmailmessageflow:[apiAction] Exception prefix: WorkMailMessageFlow Amazon WorkSpaces Task state resource: arn:aws:states:::aws-sdk:workspaces:[apiAction] Exception prefix: WorkSpaces Supported service integrations 633 AWS Step Functions Developer Guide Amazon WorkSpaces Thin Client Task state resource: arn:aws:states:::aws-sdk:workspacesthinclient:[apiAction] Exception prefix: WorkSpacesThinClient Amazon WorkSpaces Web Task state resource: arn:aws:states:::aws-sdk:workspacesweb:[apiAction] Exception prefix: WorkSpacesWeb AWS X-Ray Task state resource: arn:aws:states:::aws-sdk:xray:[apiAction] Exception prefix: XRay re:Post Private Task state resource: arn:aws:states:::aws-sdk:repostspace:[apiAction] Exception prefix: Repostspace Deprecated AWS SDK service integrations The following AWS SDK service integrations are now deprecated: • AWS Mobile • Amazon Macie • AWS IoT RoboRunner Deprecated service integrations 634 AWS Step Functions Developer Guide Integrating optimized services with Step Functions You can call Optimized integrations services directly from the Amazon States Language in the Resource field of a Task state. The following topics include the supported APIs, parameters, request/response syntax in the Amazon States Language for coordinating other AWS services. You can use three service integration patterns: • Request a Response (default) - wait for HTTP response, then go to the next state • Run a Job (.sync) - wait for the job to complete • Wait for Callback (.waitForTaskToken) - pause a workflow until a task token is returned Standard Workflows and Express Workflows support the same integrations but not the
|
step-functions-dg-186
|
step-functions-dg.pdf
| 186 |
call Optimized integrations services directly from the Amazon States Language in the Resource field of a Task state. The following topics include the supported APIs, parameters, request/response syntax in the Amazon States Language for coordinating other AWS services. You can use three service integration patterns: • Request a Response (default) - wait for HTTP response, then go to the next state • Run a Job (.sync) - wait for the job to complete • Wait for Callback (.waitForTaskToken) - pause a workflow until a task token is returned Standard Workflows and Express Workflows support the same integrations but not the same integration patterns. • Standard Workflows support Request Response integrations. Certain services support Run a Job (.sync), or Wait for Callback (.waitForTaskToken) , and both in some cases. See the following optimized integrations table for details. • Express Workflows only support Request Response integrations. To help decide between the two types, see Choosing workflow type in Step Functions. AWS SDK integrations in Step Functions Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Over two hundred services Standard & Express Not supported Standard Optimized integrations in Step Functions 635 AWS Step Functions Developer Guide Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Amazon API Gateway Standard & Express Not supported Standard Amazon Athena Standard & Express Standard Not supported AWS Batch Standard & Express Standard Not supported Amazon Bedrock Standard & Express Standard Standard AWS CodeBuild Standard & Express Standard Not supported Amazon DynamoDB Standard & Express Not supported Not supported Amazon ECS/Fargate Standard & Express Standard Amazon EKS Standard & Express Standard Standard Standard Amazon EMR Standard & Express Standard Not supported Amazon EMR on EKS Standard & Express Standard Not supported Amazon EMR Serverless Standard & Express Standard Not supported Amazon EventBridge Standard & Express Not supported Standard AWS Glue Standard & Express Standard Not supported AWS Glue DataBrew Standard & Express Standard Not supported AWS Lambda Standard & Express Not supported Standard AWS Elemental MediaConvert Amazon SageMaker AI Standard & Express Standard Not supported Standard & Express Standard Not supported Amazon SNS Standard & Express Not supported Standard 636 AWS Step Functions Developer Guide Integrated service Request Response Run a Job - .sync Wait for Callback - .waitForTaskToken Amazon SQS Standard & Express Not supported Standard AWS Step Functions Standard & Express Standard Standard Create API Gateway REST APIs with Step Functions Learn how to use Amazon API Gateway to create, publish, maintain, and monitor HTTP and REST APIs with Step Functions. To integrate with API Gateway, you define a Task state in Step Functions that directly calls an API Gateway HTTP or API Gateway REST endpoint, without writing code or relying on other infrastructure. A Task state definition includes all the necessary information for the API call. You can also select different authorization methods. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized API Gateway integration • apigateway:invoke: has no equivalent in the AWS SDK service integration. Instead, the Optimized API Gateway service calls your API Gateway endpoint directly. API Gateway feature support The Step Functions API Gateway integration supports some, but not all API Gateway features. For a more detailed list of supported features, see the following. • Supported by both the Step Functions API Gateway REST API and API Gateway HTTP API integrations: • Authorizers: IAM (using Signature Version 4), No Auth, Lambda Authorizers (request- parameter based and token-based with custom header) • API types: Regional • API management: API Gateway API domain names, API stage, Path, Query Parameters, Request Body Amazon API Gateway 637 AWS Step Functions Developer Guide • Supported by the Step Functions API Gateway HTTP API integration. The Step Functions API Gateway REST API integration that provides the option for Edge-optimized APIs are not supported. • Unsupported by the Step Functions API Gateway integration: • Authorizers: Amazon Cognito, Native Open ID Connect / OAuth 2.0, Authorization header for token-based Lambda authorizers • API types: Private • API management: Custom domain names For more information about API Gateway and its HTTP and REST APIs, see the following. • The Amazon API Gateway concepts page. • Choosing between HTTP APIs and REST APIs in the API Gateway developer guide. Request format When you create your Task state definition, Step Functions validates the parameters, builds the necessary URL to perform the call, then calls the API. The response includes the HTTP status code, headers and response body. The request format has both required and optional parameters. Required request parameters • ApiEndpoint • Type: String • The hostname of an API Gateway URL. The format is <API ID>.execute- api.region.amazonaws.com. The API ID can only contain
|
step-functions-dg-187
|
step-functions-dg.pdf
| 187 |
REST APIs, see the following. • The Amazon API Gateway concepts page. • Choosing between HTTP APIs and REST APIs in the API Gateway developer guide. Request format When you create your Task state definition, Step Functions validates the parameters, builds the necessary URL to perform the call, then calls the API. The response includes the HTTP status code, headers and response body. The request format has both required and optional parameters. Required request parameters • ApiEndpoint • Type: String • The hostname of an API Gateway URL. The format is <API ID>.execute- api.region.amazonaws.com. The API ID can only contain a combination of the following alphanumeric characters: 0123456789abcdefghijklmnopqrstuvwxyz • Method • Type: Enum • The HTTP method, which must be one of the following: • GET • POST • PUT Request format 638 AWS Step Functions Developer Guide • DELETE • PATCH • HEAD • OPTIONS Optional request parameters • Headers • Type: JSON • HTTP headers allow a list of values associated with the same key. • Stage • Type: String • The name of the stage where the API is deployed to in API Gateway. It's optional for any HTTP API that uses the $default stage. • Path • Type: String • Path parameters that are appended after the API endpoint. • QueryParameters • Type: JSON • Query strings only allow a list of values associated with the same key. • RequestBody • Type: JSON or String • The HTTP Request body. Its type can be either a JSON object or String. RequestBody is only supported for PATCH, POST, and PUT HTTP methods. • AllowNullValues • Type: BOOLEAN – default value: false • With the default setting, any null values in the request input state will not be sent to your API. In the following example, the category field will not be included in the request, unless AllowNullValues is set to true in your state machine definition. { Request format "NewPet": { 639 AWS Step Functions Developer Guide "type": "turtle", "price": 123, "category": null } } Note By default, fields with null values in the request input state will not be sent to your API. You can force null values to be sent to your API by setting AllowNullValues to true in your state machine definition. • AuthType • Type: JSON • The authentication method. The default method is NO_AUTH. The allowed values are: • NO_AUTH • IAM_ROLE • RESOURCE_POLICY See Authentication and authorization for more information. Note For security considerations, the following HTTP header keys are not currently permitted: • Anything prefixed with X-Forwarded, X-Amz or X-Amzn. • Authorization • Connection • Content-md5 • Expect • Host • Max-Forwards • Proxy-Authenticate • Server Request format • TE 640 AWS Step Functions Developer Guide • Transfer-Encoding • Trailer • Upgrade • Via • Www-Authenticate The following code example shows how to invoke API Gateway using Step Functions. { "Type": "Task", "Resource":"arn:aws:states:::apigateway:invoke", "Arguments": { "ApiEndpoint": "example.execute-api.us-east-1.amazonaws.com", "Method": "GET", "Headers": { "key": ["value1", "value2"] }, "Stage": "prod", "Path": "bills", "QueryParameters": { "billId": ["123456"] }, "RequestBody": {}, "AuthType": "NO_AUTH" } } Authentication and authorization You can use the following authentication methods: • No authorization: Call the API directly with no authorization method. • IAM role: With this method, Step Functions assumes the role of the state machine, signs the request with Signature Version 4 (SigV4), then calls the API. • Resource policy: Step Functions authenticates the request, and then calls the API. You must attach a resource policy to the API which specifies the following: 1. The state machine that will invoke API Gateway. Authentication and authorization 641 AWS Step Functions Developer Guide Important You must specify your state machine to limit access to it. If you do not, then any state machine that authenticates its API Gateway request with Resource policy authentication to your API will be granted access. 2. That Step Functions is the service calling API Gateway: "Service": "states.amazonaws.com". 3. The resource you want to access, including: • The region. • The account-id in the specified region. • The api-id. • The stage-name. • The HTTP-VERB (method). • The resource-path-specifier. For an example resource policy, see IAM policies for Step Functions and API Gateway. For more information on the resource format, see Resource format of permissions for executing API in API Gateway in the API Gateway Developer Guide. Note Resource policies are only supported for the REST API. Service integration patterns The API Gateway integration supports two service integration patterns: • Request Response, which is the default integration pattern. It lets Step Functions progress to the next step immediately after it receives an HTTP response. • Wait for a Callback with Task Token (.waitForTaskToken), which waits until a task token is returned with a payload. To use the .waitForTaskToken pattern, append .waitForTaskToken to the end of the Resource
|
step-functions-dg-188
|
step-functions-dg.pdf
| 188 |
the resource format, see Resource format of permissions for executing API in API Gateway in the API Gateway Developer Guide. Note Resource policies are only supported for the REST API. Service integration patterns The API Gateway integration supports two service integration patterns: • Request Response, which is the default integration pattern. It lets Step Functions progress to the next step immediately after it receives an HTTP response. • Wait for a Callback with Task Token (.waitForTaskToken), which waits until a task token is returned with a payload. To use the .waitForTaskToken pattern, append .waitForTaskToken to the end of the Resource field of your task definition as shown in the following example: Service integration patterns 642 AWS Step Functions Developer Guide { "Type": "Task", "Resource":"arn:aws:states:::apigateway:invoke.waitForTaskToken", "Arguments": { "ApiEndpoint": "example.execute-api.us-east-1.amazonaws.com", "Method": "POST", "Headers": { "TaskToken": "{% $states.context.Task.Token %}" }, "Stage": "prod", "Path": "bills/add", "QueryParameters": {}, "RequestBody": { "billId": "my-new-bill" }, "AuthType": "IAM_ROLE" } } Output format The following output parameters are provided: Name Type Description ResponseBody JSON or String Headers StatusCode JSON Integer StatusText String An example response: The response body of the API call. The response headers. The HTTP status code of the response. The status text of the response. Output format 643 AWS Step Functions Developer Guide { "ResponseBody": { "myBills": [] }, "Headers": { "key": ["value1", "value2"] }, "StatusCode": 200, "StatusText": "OK" } Error handling When an error occurs, an error and cause is returned as follows: • If the HTTP status code is available, then the error will be returned in the format ApiGateway.<HTTP Status Code>. • If the HTTP status code is not available, then the error will be returned in the format ApiGateway.<Exception>. In both cases, the cause is returned as a string. The following example shows a response where an error has occurred: { "error": "ApiGateway.403", "cause": "{\"message\":\"Missing Authentication Token\"}" } Note A status code of 2XX indicates success, and no error will be returned. All other status codes or thrown exceptions will result in an error. IAM policies for calls to Amazon API Gateway The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions Error handling 644 AWS Step Functions Developer Guide generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Resources: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "execute-api:Invoke" ], "Resource": [ "arn:region:account-id:*" ] } ] } The following code example shows a resource policy for calling API Gateway. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "states.amazonaws.com" }, "Action": "execute-api:Invoke", "Resource": "arn:aws:execute-api:region:account-id:api-id/stage-name/HTTP- VERB/resource-path-specifier", "Condition": { "StringEquals": { "aws:SourceArn": [ "<SourceStateMachineArn>" ] } } } ] } IAM policies 645 AWS Step Functions Developer Guide Run Athena queries with Step Functions You can integrate AWS Step Functions with Amazon Athena to start and stop query execution and get query results with Step Functions. Using Step Functions, you can run ad-hoc or scheduled data queries, and retrieve results targeting your S3 data lakes. Athena is serverless, so there is no infrastructure to set up or manage, and you pay only for the queries you run. This page lists the supported Athena APIs and provides an example Task state to start an Athena query. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized Athena integration • The Run a Job (.sync) integration pattern is supported. • There are no specific optimizations for the Request Response integration pattern. • The Wait for a Callback with Task Token integration pattern is not supported. To integrate AWS Step Functions with Amazon Athena, you use the provided Athena service integration APIs. The service integration APIs are the same as the corresponding Athena APIs. Not all APIs support all integration patterns, as shown in the following table. API Request Response Run a Job (.sync) StartQueryExecution Supported Supported StopQueryExecution Supported GetQueryExecution Supported GetQueryResults Supported Not supported Not supported Not supported The following includes a Task state that starts an Athena query. "Start an Athena query": { "Type": "Task", Amazon Athena 646 AWS Step Functions Developer Guide "Resource": "arn:aws:states:::athena:startQueryExecution.sync", "Arguments": { "QueryString": "SELECT * FROM \"myDatabase\".\"myTable\" limit 1", "WorkGroup": "primary", "ResultConfiguration": { "OutputLocation": "s3://amzn-s3-demo-bucket" } }, "Next": "Get results of the query" } Optimized Amazon Athena APIs: • StartQueryExecution • Request syntax • Supported parameters: • ClientRequestToken • ExecutionParameters • QueryExecutionContext • QueryString • ResultConfiguration • WorkGroup • Response syntax • StopQueryExecution • Request syntax • Supported parameters: • QueryExecutionId • GetQueryExecution • Request syntax • Supported parameters: • QueryExecutionId • Response syntax • GetQueryResults • Request syntax Supported APIs 647 AWS Step Functions • Supported parameters: • MaxResults • NextToken • QueryExecutionId • Response
|
step-functions-dg-189
|
step-functions-dg.pdf
| 189 |
Developer Guide "Resource": "arn:aws:states:::athena:startQueryExecution.sync", "Arguments": { "QueryString": "SELECT * FROM \"myDatabase\".\"myTable\" limit 1", "WorkGroup": "primary", "ResultConfiguration": { "OutputLocation": "s3://amzn-s3-demo-bucket" } }, "Next": "Get results of the query" } Optimized Amazon Athena APIs: • StartQueryExecution • Request syntax • Supported parameters: • ClientRequestToken • ExecutionParameters • QueryExecutionContext • QueryString • ResultConfiguration • WorkGroup • Response syntax • StopQueryExecution • Request syntax • Supported parameters: • QueryExecutionId • GetQueryExecution • Request syntax • Supported parameters: • QueryExecutionId • Response syntax • GetQueryResults • Request syntax Supported APIs 647 AWS Step Functions • Supported parameters: • MaxResults • NextToken • QueryExecutionId • Response syntax Developer Guide Quota for input or result data When sending or receiving data between services, the maximum input or result for a task is 256 KiB of data as a UTF-8 encoded string. See Quotas related to state machine executions. IAM policies for calling Amazon Athena The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. StartQueryExecution Static resources Run a Job (.sync) { "Version": "2012-10-17", "Statement":[ { "Effect": "Allow", "Action": [ "athena:startQueryExecution", "athena:stopQueryExecution", "athena:getQueryExecution", "athena:getDataCatalog" ], "Resource": [ "arn:aws:athena:region:account-id:workgroup/workGroup", "arn:aws:athena:region:account-id:datacatalog/*" IAM policies 648 AWS Step Functions ] }, { Developer Guide "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload", "s3:CreateBucket", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::*" ] }, { "Effect": "Allow", "Action": [ "glue:CreateDatabase", "glue:GetDatabase", "glue:GetDatabases", "glue:UpdateDatabase", "glue:DeleteDatabase", "glue:CreateTable", "glue:UpdateTable", "glue:GetTable", "glue:GetTables", "glue:DeleteTable", "glue:BatchDeleteTable", "glue:BatchCreatePartition", "glue:CreatePartition", "glue:UpdatePartition", "glue:GetPartition", "glue:GetPartitions", "glue:BatchGetPartition", "glue:DeletePartition", "glue:BatchDeletePartition" ], "Resource": [ "arn:aws:glue:region:account-id:catalog", "arn:aws:glue:region:account-id:database/*", IAM policies 649 AWS Step Functions Developer Guide "arn:aws:glue:region:account-id:table/*", "arn:aws:glue:region:account-id:userDefinedFunction/*" ] }, { "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess" ], "Resource": [ "*" ] } ] } Request Response { "Version": "2012-10-17", "Statement":[ { "Effect": "Allow", "Action": [ "athena:startQueryExecution", "athena:getDataCatalog" ], "Resource": [ "arn:aws:athena:region:account-id:workgroup/workGroup", "arn:aws:athena:region:account-id:datacatalog/*" ] }, { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload", "s3:CreateBucket", "s3:PutObject" IAM policies 650 Developer Guide AWS Step Functions ], "Resource": [ "arn:aws:s3:::*" ] }, { "Effect": "Allow", "Action": [ "glue:CreateDatabase", "glue:GetDatabase", "glue:GetDatabases", "glue:UpdateDatabase", "glue:DeleteDatabase", "glue:CreateTable", "glue:UpdateTable", "glue:GetTable", "glue:GetTables", "glue:DeleteTable", "glue:BatchDeleteTable", "glue:BatchCreatePartition", "glue:CreatePartition", "glue:UpdatePartition", "glue:GetPartition", "glue:GetPartitions", "glue:BatchGetPartition", "glue:DeletePartition", "glue:BatchDeletePartition" ], "Resource": [ "arn:aws:glue:region:account-id:catalog", "arn:aws:glue:region:account-id:database/*", "arn:aws:glue:region:account-id:table/*", "arn:aws:glue:region:account-id:userDefinedFunction/*" ] }, { "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess" ], "Resource": [ "*" ] } IAM policies 651 AWS Step Functions ] } Dynamic resources Run a Job (.sync) Developer Guide { "Version": "2012-10-17", "Statement":[ { "Effect": "Allow", "Action": [ "athena:startQueryExecution", "athena:stopQueryExecution", "athena:getQueryExecution", "athena:getDataCatalog" ], "Resource": [ "arn:aws:athena:region:account-id:workgroup/*", "arn:aws:athena:region:account-id:datacatalog/*" ] }, { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload", "s3:CreateBucket", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::*" ] }, { "Effect": "Allow", "Action": [ IAM policies 652 AWS Step Functions Developer Guide "glue:CreateDatabase", "glue:GetDatabase", "glue:GetDatabases", "glue:UpdateDatabase", "glue:DeleteDatabase", "glue:CreateTable", "glue:UpdateTable", "glue:GetTable", "glue:GetTables", "glue:DeleteTable", "glue:BatchDeleteTable", "glue:BatchCreatePartition", "glue:CreatePartition", "glue:UpdatePartition", "glue:GetPartition", "glue:GetPartitions", "glue:BatchGetPartition", "glue:DeletePartition", "glue:BatchDeletePartition" ], "Resource": [ "arn:aws:glue:region:account-id:catalog", "arn:aws:glue:region:account-id:database/*", "arn:aws:glue:region:account-id:table/*", "arn:aws:glue:region:account-id:userDefinedFunction/*" ] }, { "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess" ], "Resource": [ "*" ] } ] } Request Response { "Version": "2012-10-17", IAM policies 653 AWS Step Functions Developer Guide "Statement":[ { "Effect": "Allow", "Action": [ "athena:startQueryExecution", "athena:getDataCatalog" ], "Resource": [ "arn:aws:athena:region:account-id:workgroup/*", "arn:aws:athena:region:account-id:datacatalog/*" ] }, { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload", "s3:CreateBucket", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::*" ] }, { "Effect": "Allow", "Action": [ "glue:CreateDatabase", "glue:GetDatabase", "glue:GetDatabases", "glue:UpdateDatabase", "glue:DeleteDatabase", "glue:CreateTable", "glue:UpdateTable", "glue:GetTable", "glue:GetTables", "glue:DeleteTable", "glue:BatchDeleteTable", "glue:BatchCreatePartition", "glue:CreatePartition", IAM policies 654 AWS Step Functions Developer Guide "glue:UpdatePartition", "glue:GetPartition", "glue:GetPartitions", "glue:BatchGetPartition", "glue:DeletePartition", "glue:BatchDeletePartition" ], "Resource": [ "arn:aws:glue:region:account-id:catalog", "arn:aws:glue:region:account-id:database/*", "arn:aws:glue:region:account-id:table/*", "arn:aws:glue:region:account-id:userDefinedFunction/*" ] }, { "Effect": "Allow", "Action": [ "lakeformation:GetDataAccess" ], "Resource": [ "*" ] } ] } StopQueryExecution Resources { "Version": "2012-10-17", "Statement":[ { "Effect": "Allow", "Action": [ "athena:stopQueryExecution" ], "Resource": [ "arn:aws:athena:region:account-id:workgroup/*" ] } IAM policies 655 Developer Guide AWS Step Functions ] } GetQueryExecution Resources { "Version": "2012-10-17", "Statement":[ { "Effect": "Allow", "Action": [ "athena:getQueryExecution" ], "Resource": [ "arn:aws:athena:region:account-id:workgroup/*" ] } ] } GetQueryResults Resources { "Version": "2012-10-17", "Statement":[ { "Effect": "Allow", "Action": [ "athena:getQueryResults" ], "Resource": [ "arn:aws:athena:region:account-id:workgroup/*" ] }, { "Effect": "Allow", "Action": [ "s3:GetObject" IAM policies 656 AWS Step Functions ], "Resource": [ "arn:aws:s3:::*" ] } ] } Developer Guide Run AWS Batch workloads with Step Functions You can integrate Step Functions with AWS Batch to run batch computing workloads in the AWS cloud. This page lists the supported AWS Batch APIs and provides an example Task state to perform a batch-processing task. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized AWS Batch integration • The Run a Job (.sync) integration pattern is available. Note that there are no specific optimizations for the Request Response or Wait for a Callback with Task Token integration patterns. The following shows an example Task
|
step-functions-dg-190
|
step-functions-dg.pdf
| 190 |
Step Functions with AWS Batch to run batch computing workloads in the AWS cloud. This page lists the supported AWS Batch APIs and provides an example Task state to perform a batch-processing task. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized AWS Batch integration • The Run a Job (.sync) integration pattern is available. Note that there are no specific optimizations for the Request Response or Wait for a Callback with Task Token integration patterns. The following shows an example Task state that submits an AWS Batch job and waits for it to complete. Many of the arguments shown are optional. "Submit Batch Job": { "Type": "Task", "Resource": "arn:aws:states:::batch:submitJob.sync", "Arguments": { "JobName": "BATCH_NAME", "JobQueue": "BATCH_QUEUE_ARN", "JobDefinition": "BATCH_JOB_DEFINITION_ARN", "ArrayProperties": { "Size": 10 }, "ContainerOverrides": { AWS Batch 657 AWS Step Functions Developer Guide "ResourceRequirements": [ { "Type": "VCPU", "Value": "4" } ] }, "DependsOn": [ { "JobId": "myJobId", "Type": "SEQUENTIAL" } ], "PropagateTags": true, "Arguments": { "Key1": "value1", "Key2": 100 }, "RetryStrategy": { "Attempts": 1 }, "Tags": { "Tag": "TAG" }, "Timeout": { "AttemptDurationSeconds": 10 } } } Optimized AWS Batch APIs: • SubmitJob • Request syntax • Supported parameters: • ArrayProperties • ContainerOverrides • DependsOn • JobDefinition • JobName Supported APIs 658 AWS Step Functions Developer Guide • JobQueue • Parameters • RetryStrategy • Timeout • Tags • Response syntax Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. IAM policies for calling AWS Batch The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Because job ids for SubmitJob and TerminateJob are generated and therefore only known at runtime, you cannot create a policy that restricts access based on a specific resource. Tip for fine grained access To add fine grained access to SubmitJob and TerminateJob, consider using tags for jobs and creating a policy that limits access based on your tags. In addition, the job queue, definition, and consumable resources can be restricted for SubmitJob using known resources. Run a Job (.sync) { "Version": "2012-10-17", IAM policies 659 AWS Step Functions Developer Guide "Statement": [ { "Effect": "Allow", "Action": [ "batch:SubmitJob", "batch:DescribeJobs", "batch:TerminateJob" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForBatchJobsRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "batch:SubmitJob" ], "Resource": "*" } ] } IAM policies 660 AWS Step Functions Developer Guide Invoke and customize Amazon Bedrock models with Step Functions You can integrate Step Functions with Amazon Bedrock to invoke a specified Amazon Bedrock model and create a fine-tuning job to customize a model. This page lists the optimized Amazon Bedrock APIs and provides an example Task state to extract the result of a model invocation. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Tip To deploy an example workflow that integrates with Amazon Bedrock, see Perform AI prompt-chaining with Amazon Bedrock. Amazon Bedrock service integration APIs To integrate AWS Step Functions with Amazon Bedrock, you can use the following APIs. These APIs are similar to the corresponding Amazon Bedrock APIs, except InvokeModel has additional request fields. Amazon Bedrock API - CreateModelCustomizationJob Creates a fine-tuning job to customize a base model. You can invoke the Step Functions integration API with CreateModelCustomizationJob for Request Response, or CreateModelCustomizationJob.sync for Run a Job (.sync) integration patterns. There are no differences in the fields for the API calls. Amazon Bedrock API - InvokeModel Invokes the specified Amazon Bedrock model to run inference using the input you provide in the request body. You use InvokeModel to run inference for text models, image models, and embedding models. The Amazon Bedrock service integration API request body for InvokeModel includes the following additional parameters. • Body – Specifies input data in the format specified in the content-type request header. Body contains parameters specific to the target model. Amazon Bedrock 661 AWS Step Functions Developer Guide If you use the InvokeModel API, you must specify the Body parameter. Step Functions doesn't validate the input you provide in Body. When you specify Body using the Amazon Bedrock optimized integration, you can specify a payload of up to 256 KiB. If your payload exceeds 256 KiB, we recommend that you use Input. • Input – Specifies the source to retrieve the input data from. This optional field is specific to Amazon
|
step-functions-dg-191
|
step-functions-dg.pdf
| 191 |
input data in the format specified in the content-type request header. Body contains parameters specific to the target model. Amazon Bedrock 661 AWS Step Functions Developer Guide If you use the InvokeModel API, you must specify the Body parameter. Step Functions doesn't validate the input you provide in Body. When you specify Body using the Amazon Bedrock optimized integration, you can specify a payload of up to 256 KiB. If your payload exceeds 256 KiB, we recommend that you use Input. • Input – Specifies the source to retrieve the input data from. This optional field is specific to Amazon Bedrock optimized integration with Step Functions. In this field, you can specify an S3Uri. You can specify either Body in the Parameters or Input, but not both. When you specify Input without specifying ContentType, the content type of the input data source becomes the value for ContentType. • Output – Specifies the destination where the API response is written. This optional field is specific to Amazon Bedrock optimized integration with Step Functions. In this field, you can specify an S3Uri. If you specify this field, the API response body is replaced with a reference to the Amazon S3 location of the original output. The following example shows the syntax for InvokeModel API for Amazon Bedrock integration. { "ModelId": String, // required "Accept": String, // default: application/json "ContentType": String, // default: application/json "Input": { // not from Bedrock API "S3Uri": String }, "Output": { // not from Bedrock API "S3Uri": String } } Task state definition for Amazon Bedrock integration The following Task state definition shows how you can integrate with Amazon Bedrock in your state machines. This example shows a Task state that extracts the full result of model invocation Task state definition 662 AWS Step Functions Developer Guide specified by the path, result_one. This is based on Inference parameters for foundation models. This example uses the Cohere Command large language model (LLM). { "Type": "Task", "Resource": "arn:aws:states:::bedrock:invokeModel", "Arguments": { "ModelId": "cohere.command-text-v14", "Body": { "prompt": "{% states.input.prompt_one %}", "max_tokens": 20 }, "ContentType": "application/json", "Accept": "*/*" }, "End": true } IAM policies for calling Amazon Bedrock When you create a state machine using the console, Step Functions automatically creates an execution role for your state machine with the least privileges required. These automatically generated IAM roles are valid for the AWS Region in which you create the state machine. We recommend that when you create IAM policies, do not include wildcards in the policies. As a security best practice, you should scope your policies down as much as possible. You should use dynamic policies only when certain input parameters are not known during runtime. The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. IAM policy examples for Amazon Bedrock integration The following section describes the IAM permissions you need based on the Amazon Bedrock API that you use for a specific foundation or provisioned model. This section also contains examples of policies that grant full access. Remember to replace the italicized text with your resource-specific information. IAM policies 663 AWS Step Functions Developer Guide • IAM policy example to access a specific foundation model using InvokeModel • IAM policy example to access a specific provisioned model using InvokeModel • Full access IAM policy example to use InvokeModel • IAM policy example to access a specific foundation model as a base model • IAM policy example to access a specific custom model as a base model • Full access IAM policy example to use CreateModelCustomizationJob.sync • IAM policy example to access a specific foundation model using CreateModelCustomizationJob.sync • IAM policy example to access a custom model using CreateModelCustomizationJob.sync • Full access IAM policy example to use CreateModelCustomizationJob.sync IAM policy example to access a specific foundation model using InvokeModel The following is an IAM policy example for a state machine that accesses a specific foundation model named amazon.titan-text-express-v1 using the InvokeModel API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "InvokeModel1", "Action": [ "bedrock:InvokeModel" ], "Resource": [ "arn:aws:bedrock:region::foundation-model/amazon.titan-text-express-v1" ] } ] } IAM policy example to access a specific provisioned model using InvokeModel The following is an IAM policy example for a state machine that accesses a specific provisioned model named c2oi931ulksx using the InvokeModel API action. { IAM policies 664 AWS Step Functions Developer Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "InvokeModel1", "Action": [ "bedrock:InvokeModel" ], "Resource": [ "arn:aws:bedrock:region:account-id:provisioned-model/c2oi931ulksx" ] } ] } Full access IAM policy example to use InvokeModel The following is an IAM policy example for a state machine that provides full access when you use the InvokeModel API action. { "Version":
|
step-functions-dg-192
|
step-functions-dg.pdf
| 192 |
] } ] } IAM policy example to access a specific provisioned model using InvokeModel The following is an IAM policy example for a state machine that accesses a specific provisioned model named c2oi931ulksx using the InvokeModel API action. { IAM policies 664 AWS Step Functions Developer Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "InvokeModel1", "Action": [ "bedrock:InvokeModel" ], "Resource": [ "arn:aws:bedrock:region:account-id:provisioned-model/c2oi931ulksx" ] } ] } Full access IAM policy example to use InvokeModel The following is an IAM policy example for a state machine that provides full access when you use the InvokeModel API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "InvokeModel1", "Action": [ "bedrock:InvokeModel" ], "Resource": [ "arn:aws:bedrock:region::foundation-model/*", "arn:aws:bedrock:region:account-id:provisioned-model/*" ] } ] } IAM policy example to access a specific foundation model as a base model The following is an IAM policy example for a state machine to access a specific foundation model named amazon.titan-text-express-v1 as a base model using the CreateModelCustomizationJob API action. IAM policies 665 AWS Step Functions Developer Guide { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "CreateModelCustomizationJob1", "Action": [ "bedrock:CreateModelCustomizationJob" ], "Resource": [ "arn:aws:bedrock:region::foundation-model/amazon.titan-text-express- v1", "arn:aws:bedrock:region:account-id:custom-model/*", "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, { "Effect": "Allow", "Sid": "CreateModelCustomizationJob2", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/myRole" ] } ] } IAM policy example to access a specific custom model as a base model The following is an IAM policy example for a state machine to access a specific custom model as a base model using the CreateModelCustomizationJob API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "CreateModelCustomizationJob1", "Action": [ "bedrock:CreateModelCustomizationJob" ], IAM policies 666 AWS Step Functions "Resource": [ Developer Guide "arn:aws:bedrock:region:account-id:custom-model/*", "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, { "Effect": "Allow", "Sid": "CreateModelCustomizationJob2", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/roleName" ] } ] } Full access IAM policy example to use CreateModelCustomizationJob.sync The following is an IAM policy example for a state machine that provides full access when you use the CreateModelCustomizationJob API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "CreateModelCustomizationJob1", "Action": [ "bedrock:CreateModelCustomizationJob" ], "Resource": [ "arn:aws:bedrock:region::foundation-model/*", "arn:aws:bedrock:region:account-id:custom-model/*", "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, { "Effect": "Allow", "Sid": "CreateModelCustomizationJob2", "Action": [ "iam:PassRole" IAM policies 667 AWS Step Functions ], "Resource": [ "arn:aws:iam::account-id:role/myRole" Developer Guide ] } ] } IAM policy example to access a specific foundation model using CreateModelCustomizationJob.sync The following is an IAM policy example for a state machine to access a specific foundation model named amazon.titan-text-express-v1 using the CreateModelCustomizationJob.sync API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "CreateModelCustomizationJob1", "Action": [ "bedrock:CreateModelCustomizationJob" ], "Resource": [ "arn:aws:bedrock:region::foundation-model/amazon.titan-text-express- v1", "arn:aws:bedrock:region:account-id:custom-model/*", "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, { "Effect": "Allow", "Sid": "CreateModelCustomizationJob2", "Action": [ "bedrock:GetModelCustomizationJob", "bedrock:StopModelCustomizationJob" ], "Resource": [ "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, { IAM policies 668 AWS Step Functions Developer Guide "Effect": "Allow", "Sid": "CreateModelCustomizationJob3", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/myRole" ] } ] } IAM policy example to access a custom model using CreateModelCustomizationJob.sync The following is an IAM policy example for a state machine to access a custom model using the CreateModelCustomizationJob.sync API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "CreateModelCustomizationJob1", "Action": [ "bedrock:CreateModelCustomizationJob" ], "Resource": [ "arn:aws:bedrock:region:account-id:custom-model/*", "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, { "Effect": "Allow", "Sid": "CreateModelCustomizationJob2", "Action": [ "bedrock:GetModelCustomizationJob", "bedrock:StopModelCustomizationJob" ], "Resource": [ "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, { IAM policies 669 AWS Step Functions Developer Guide "Effect": "Allow", "Sid": "CreateModelCustomizationJob3", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/myRole" ] } ] } Full access IAM policy example to use CreateModelCustomizationJob.sync The following is an IAM policy example for a state machine that provides full access when you use the CreateModelCustomizationJob.sync API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Sid": "CreateModelCustomizationJob1", "Action": [ "bedrock:CreateModelCustomizationJob" ], "Resource": [ "arn:aws:bedrock:region::foundation-model/*", "arn:aws:bedrock:region:account-id:custom-model/*", "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, { "Effect": "Allow", "Sid": "CreateModelCustomizationJob2", "Action": [ "bedrock:GetModelCustomizationJob", "bedrock:StopModelCustomizationJob" ], "Resource": [ "arn:aws:bedrock:region:account-id:model-customization-job/*" ] }, IAM policies 670 AWS Step Functions { "Effect": "Allow", "Sid": "CreateModelCustomizationJob3", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/myRole" Developer Guide ] } ] } Manage AWS CodeBuild builds with Step Functions You can integrate Step Functions with AWS CodeBuild to start, stop, and manage builds. This page lists the supported CodeBuild APIs you can use with Step Functions. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. With the Step Functions integration with AWS CodeBuild you can use Step Functions to trigger, stop, and manage builds, and to share build reports. Using Step Functions, you can design and run continuous integration pipelines for validating your software changes for applications. Key features of Optimized CodeBuild integration • The Run a Job (.sync) integration pattern is supported. • After you call StopBuild or StopBuildBatch, the build or build batch is not immediately deletable until some internal work is completed within CodeBuild to finalize the state of the build or builds. If you attempt to use BatchDeleteBuilds or DeleteBuildBatch during this period,
|
step-functions-dg-193
|
step-functions-dg.pdf
| 193 |
Step Functions integration with AWS CodeBuild you can use Step Functions to trigger, stop, and manage builds, and to share build reports. Using Step Functions, you can design and run continuous integration pipelines for validating your software changes for applications. Key features of Optimized CodeBuild integration • The Run a Job (.sync) integration pattern is supported. • After you call StopBuild or StopBuildBatch, the build or build batch is not immediately deletable until some internal work is completed within CodeBuild to finalize the state of the build or builds. If you attempt to use BatchDeleteBuilds or DeleteBuildBatch during this period, the build or build batch may not be deleted. The optimized service integrations for BatchDeleteBuilds and DeleteBuildBatch include an internal retry to simplify the use case of deleting immediately after stopping. Not all APIs support all integration patterns, as shown in the following table. AWS CodeBuild 671 AWS Step Functions Developer Guide Request Response Run a Job (.sync) API StartBuild StopBuild Supported Supported BatchDeleteBuilds Supported BatchGetReports Supported StartBuildBatch StopBuildBatch RetryBuildBatch Supported Supported Supported Supported Not supported Not supported Not supported Supported Not supported Supported DeleteBuildBatch Supported Not supported Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. Optimized CodeBuild APIs • StartBuild • Request syntax • Supported parameters: • ProjectName • ArtifactsOverride • BuildspecOverride • CacheOverride • CertificateOverride • ComputeTypeOverride Supported APIs 672 AWS Step Functions Developer Guide • EncryptionKeyOverride • EnvironmentTypeOverride • EnvironmentVariablesOverride • GitCloneDepthOverride • GitSubmodulesConfigOverride • IdempotencyToken • ImageOverride • ImagePullCredentialsTypeOverride • InsecureSslOverride • LogsConfigOverride • PrivilegedModeOverride • QueuedTimeoutInMinutesOverride • RegistryCredentialOverride • ReportBuildStatusOverride • SecondaryArtifactsOverride • SecondarySourcesOverride • SecondarySourcesVersionOverride • ServiceRoleOverride • SourceAuthOverride • SourceLocationOverride • SourceTypeOverride • SourceVersion • TimeoutInMinutesOverride • Response syntax • StopBuild • Request syntax • Supported parameters: • Id • Response syntax Supported APIs • BatchDeleteBuilds 673 Developer Guide AWS Step Functions • Request syntax • Supported parameters: • Ids • Response syntax • BatchGetReports • Request syntax • Supported parameters: • ReportArns • Response syntax • StartBuildBatch • Request syntax • Supported parameters: • ProjectName • ArtifactsOverride • BuildBatchConfigOverride • BuildspecOverride • BuildTimeoutInMinutesOverride • CacheOverride • CertificateOverride • ComputeTypeOverride • DebugSessionEnabled • EncryptionKeyOverride • EnvironmentTypeOverride • EnvironmentVariablesOverride • GitCloneDepthOverride • GitSubmodulesConfigOverride • IdempotencyToken • ImageOverride • ImagePullCredentialsTypeOverride Supported APIs • InsecureSslOverride 674 AWS Step Functions Developer Guide • LogsConfigOverride • PrivilegedModeOverride • QueuedTimeoutInMinutesOverride • RegistryCredentialOverride • ReportBuildBatchStatusOverride • SecondaryArtifactsOverride • SecondarySourcesOverride • SecondarySourcesVersionOverride • ServiceRoleOverride • SourceAuthOverride • SourceLocationOverride • SourceTypeOverride • SourceVersion • Response syntax • StopBuildBatch • Request syntax • Supported parameters: • Id • Response syntax • RetryBuildBatch • Request syntax • Supported parameters: • Id • IdempotencyToken • RetryType • Response syntax • DeleteBuildBatch • Request syntax • Supported parameters: Supported APIs • Id 675 AWS Step Functions • Response syntax Note Developer Guide When using JSONPath, you can use the recursive descent operator (..) to provide parameters for BatchDeleteBuilds. With the returned array, you can transform the Arn field from StartBuild into a plural Ids parameter, as shown in the following example. "BatchDeleteBuilds": { "Type": "Task", "Resource": "arn:aws:states:::codebuild:batchDeleteBuilds", "Arguments": { "Ids.$": "$.Build..Arn" }, "Next": "MyNextState" }, IAM policies for calling AWS CodeBuild The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Resources: { "Version": "2012-10-17", "Statement": [ { "Action": [ "sns:Publish" ], "Resource": [ "arn:aws:sns:sa-east-1:account-id:StepFunctionsSample- CodeBuildExecution1111-2222-3333-wJalrXUtnFEMI-SNSTopic-bPxRfiCYEXAMPLEKEY" ], "Effect": "Allow" IAM policies 676 Developer Guide AWS Step Functions }, { "Action": [ "codebuild:StartBuild", "codebuild:StopBuild", "codebuild:BatchGetBuilds", "codebuild:BatchGetReports" ], "Resource": "*", "Effect": "Allow" }, { "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:sa-east-1:account-id:rule/ StepFunctionsGetEventForCodeBuildStartBuildRule" ], "Effect": "Allow" } ] } StartBuild Static resources Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild", "codebuild:StopBuild", "codebuild:BatchGetBuilds" ], "Resource": [ IAM policies 677 AWS Step Functions Developer Guide "arn:aws:codebuild:region:account-id:project/projectName" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventForCodeBuildStartBuildRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } Dynamic resources Run a Job (.sync) { IAM policies 678 AWS Step Functions Developer Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild", "codebuild:StopBuild", "codebuild:BatchGetBuilds" ], "Resource": [ "arn:aws:codebuild:region:*:project/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventForCodeBuildStartBuildRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild" ], "Resource": [ "arn:aws:codebuild:region:*:project/*" ] } IAM policies 679 Developer Guide AWS Step Functions ] } StopBuild Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action":
|
step-functions-dg-194
|
step-functions-dg.pdf
| 194 |
"codebuild:StartBuild" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } Dynamic resources Run a Job (.sync) { IAM policies 678 AWS Step Functions Developer Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild", "codebuild:StopBuild", "codebuild:BatchGetBuilds" ], "Resource": [ "arn:aws:codebuild:region:*:project/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventForCodeBuildStartBuildRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild" ], "Resource": [ "arn:aws:codebuild:region:*:project/*" ] } IAM policies 679 Developer Guide AWS Step Functions ] } StopBuild Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StopBuild" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StopBuild" ], "Resource": [ "arn:aws:codebuild:region:*:project/*" ] } ] } IAM policies 680 Developer Guide AWS Step Functions BatchDeleteBuilds Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:BatchDeleteBuilds" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:BatchDeleteBuilds" ], "Resource": [ "arn:aws:codebuild:region:*:project/*" ] } ] } BatchGetReports Static resources { "Version": "2012-10-17", IAM policies 681 AWS Step Functions "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:BatchGetReports" ], "Resource": [ "arn:aws:codebuild:region:account-id:report-group/" Developer Guide ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:BatchGetReports" ], "Resource": [ "arn:aws:codebuild:region:*:report-group/*" ] } ] } StartBuildBatch Static resources Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuildBatch", IAM policies 682 AWS Step Functions Developer Guide "codebuild:StopBuildBatch", "codebuild:BatchGetBuildBatches" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventForCodeBuildStartBuildBatchRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuildBatch" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } Dynamic resources IAM policies 683 Developer Guide AWS Step Functions Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuildBatch", "codebuild:StopBuildBatch", "codebuild:BatchGetBuildBatches" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventForCodeBuildStartBuildBatchRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuildBatch" ], "Resource": [ IAM policies 684 AWS Step Functions Developer Guide "arn:aws:codebuild:region:account-id:project/*" ] } ] } StopBuildBatch Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StopBuildBatch" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StopBuildBatch" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/*" ] } ] } IAM policies 685 AWS Step Functions RetryBuildBatch Static resources Run a Job (.sync) Developer Guide { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:RetryBuildBatch", "codebuild:StopBuildBatch", "codebuild:BatchGetBuildBatches" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:RetryBuildBatch" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } IAM policies 686 Developer Guide AWS Step Functions Dynamic resources Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:RetryBuildBatch", "codebuild:StopBuildBatch", "codebuild:BatchGetBuildBatches" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/*" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:RetryBuildBatch" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/*" ] } ] } DeleteBuildBatch Static resources IAM policies 687 AWS Step Functions Developer Guide { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:DeleteBuildBatch" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/projectName" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:DeleteBuildBatch" ], "Resource": [ "arn:aws:codebuild:region:account-id:project/*" ] } ] } Perform DynamoDB CRUD operations with Step Functions You can integrate Step Functions with DynamoDB to perform CRUD operations on a DynamoDB table. This page lists the supported DynamoDB APIs and provides an example Task state to retrieve an item from DynamoDB. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Amazon DynamoDB 688 AWS Step Functions Developer Guide Key features of optimized DynamoDB integration • There is no specific optimization for the Request Response integration pattern. • Wait for a Callback with Task Token integration pattern is not supported. • Only GetItem, PutItem, UpdateItem, and DeleteItem API actions are available through optimized integration. Other API actions, such as CreateTable are available using the DynamoDB AWS SDK integration. The following is an example Task state that retrieves a message from DynamoDB. "Read next Message from DynamoDB": { "Type": "Task", "Resource": "arn:aws:states:::dynamodb:getItem", "Arguments": { "TableName": "DYNAMO_DB_TABLE_NAME", "Key": { "MessageId": {"S": "{% $List[0] %}"} } } To see this state in a working example, see the Transfer data records with Lambda, DynamoDB, and Amazon SQS starter template. Exception prefix differences When standard DynamoDB connections experience an error, the exception prefix will be DynamoDb (mixed case). For optimized integrations,
|
step-functions-dg-195
|
step-functions-dg.pdf
| 195 |
DeleteItem API actions are available through optimized integration. Other API actions, such as CreateTable are available using the DynamoDB AWS SDK integration. The following is an example Task state that retrieves a message from DynamoDB. "Read next Message from DynamoDB": { "Type": "Task", "Resource": "arn:aws:states:::dynamodb:getItem", "Arguments": { "TableName": "DYNAMO_DB_TABLE_NAME", "Key": { "MessageId": {"S": "{% $List[0] %}"} } } To see this state in a working example, see the Transfer data records with Lambda, DynamoDB, and Amazon SQS starter template. Exception prefix differences When standard DynamoDB connections experience an error, the exception prefix will be DynamoDb (mixed case). For optimized integrations, the exception prefix will be DynamoDB (uppercase DB). Quota for input or result data When sending or receiving data between services, the maximum input or result for a task is 256 KiB of data as a UTF-8 encoded string. See Quotas related to state machine executions. Amazon DynamoDB 689 AWS Step Functions Developer Guide Optimized DynamoDB APIs • GetItem • Request syntax • Supported parameters: • Key • TableName • AttributesToGet • ConsistentRead • ExpressionAttributeNames • ProjectionExpression • ReturnConsumedCapacity • Response syntax • PutItem • Request syntax • Supported parameters: • Item • TableName • ConditionalOperator • ConditionExpression • Expected • ExpressionAttributeNames • ExpressionAttributeValues • ReturnConsumedCapacity • ReturnItemCollectionMetrics • ReturnValues • Response syntax • DeleteItem • Request syntax • Supported parameters: • Key Supported APIs 690 Developer Guide AWS Step Functions • TableName • ConditionalOperator • ConditionExpression • Expected • ExpressionAttributeNames • ExpressionAttributeValues • ReturnConsumedCapacity • ReturnItemCollectionMetrics • ReturnValues • Response syntax • UpdateItem • Request syntax • Supported parameters: • Key • TableName • AttributeUpdates • ConditionalOperator • ConditionExpression • Expected • ExpressionAttributeNames • ExpressionAttributeValues • ReturnConsumedCapacity • ReturnItemCollectionMetrics • ReturnValues • UpdateExpression • Response syntax Supported APIs 691 AWS Step Functions Developer Guide Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. IAM policies for calling DynamoDB The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem", "dynamodb:DeleteItem" ], "Resource": [ "arn:aws:dynamodb:region:account-id:table/tableName" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { IAM policies 692 AWS Step Functions Developer Guide "Effect": "Allow", "Action": [ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem", "dynamodb:DeleteItem" ], "Resource": "*" } ] } For more information about the IAM policies for all DynamoDB API actions, see IAM policies with DynamoDB in the Amazon DynamoDB Developer Guide. Additionally, for information about the IAM policies for PartiQL for DynamoDB, see IAM policies with PartiQL for DynamoDB in the Amazon DynamoDB Developer Guide. Run Amazon ECS or Fargate tasks with Step Functions Learn how to integrate Step Functions with Amazon ECS or Fargate to run and manage tasks. In Amazon ECS, a task is the fundamental unit of computation. Tasks are defined by a task definition that specifies how a Docker container should be run, including the container image, CPU and memory limits, network configuration, and other parameters. This page lists the available Amazon ECS API actions and provides instructions on how to pass data to an Amazon ECS task using Step Functions. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized Amazon ECS/Fargate integration • The Run a Job (.sync) integration pattern is supported. • ecs:runTask can return an HTTP 200 response, but have a non-empty Failures field as follows: • Request Response: Return the response and do not fail the task, which is the same as non-optimized integrations. • Run a Job or Task Token: If a non-empty Failures field is encountered, the task is failed with an AmazonECS.Unknown error. Amazon ECS/Fargate 693 AWS Step Functions Developer Guide Optimized Amazon ECS/Fargate APIs • RunTask starts a new task using the specified task definition. • Request syntax • Supported parameters: • Cluster • Group • LaunchType • NetworkConfiguration • Overrides • PlacementConstraints • PlacementStrategy • PlatformVersion • PropagateTags • TaskDefinition • EnableExecuteCommand • Response syntax Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. Passing Data to an Amazon ECS Task To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. You can use overrides to override the default command for a container, and pass input to your Amazon ECS tasks. See ContainerOverride. In the
|
step-functions-dg-196
|
step-functions-dg.pdf
| 196 |
• PlacementConstraints • PlacementStrategy • PlatformVersion • PropagateTags • TaskDefinition • EnableExecuteCommand • Response syntax Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. Passing Data to an Amazon ECS Task To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. You can use overrides to override the default command for a container, and pass input to your Amazon ECS tasks. See ContainerOverride. In the example, we have used JsonPath to pass values to the Task from the input to the Task state. Supported APIs 694 AWS Step Functions Developer Guide The following includes a Task state that runs an Amazon ECS task and waits for it to complete. { "StartAt": "Run an ECS Task and wait for it to complete", "States": { "Run an ECS Task and wait for it to complete": { "Type": "Task", "Resource": "arn:aws:states:::ecs:runTask.sync", "Arguments": { "Cluster": "cluster-arn", "TaskDefinition": "job-id", "Overrides": { "ContainerOverrides": [ { "Name": "container-name", "Command": "{% $state.input.commands %}" } ] } }, "End": true } } } The Command line in ContainerOverrides passes the commands from the state input to the container. In the previous example state machine, given the following input, each of the commands would be passed as a container override: { "commands": [ "test command 1", "test command 2", "test command 3" ] } The following includes a Task state that runs an Amazon ECS task, and then waits for the task token to be returned. See Wait for a Callback with Task Token. Passing Data to an Amazon ECS Task 695 AWS Step Functions Developer Guide { "StartAt":"Manage ECS task", "States":{ "Manage ECS task":{ "Type":"Task", "Resource":"arn:aws:states:::ecs:runTask.waitForTaskToken", "Arguments":{ "LaunchType":"FARGATE", "Cluster":"cluster-arn", "TaskDefinition":"job-id", "Overrides":{ "ContainerOverrides":[ { "Name":"container-name", "Environment":[ { "Name" : "TASK_TOKEN_ENV_VARIABLE", "Value" : "{% $states.context.Task.Token %}" } ] } ] } }, "End":true } } } IAM policies for calling Amazon ECS/AWS Fargate The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Because the value for TaskId is not known until the task is submitted, Step Functions creates a more privileged "Resource": "*" policy. IAM policies 696 AWS Step Functions Note Developer Guide You can only stop Amazon Elastic Container Service (Amazon ECS) tasks that were started by Step Functions, despite the "*" IAM policy. Run a Job (.sync) Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:RunTask" ], "Resource": [ "arn:aws:ecs:region: account-id:task-definition/taskDefinition:revisionNumber" ] }, { "Effect": "Allow", "Action": [ "ecs:StopTask", "ecs:DescribeTasks" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region: account-id:rule/StepFunctionsGetEventsForECSTaskRule" ] } IAM policies 697 Developer Guide AWS Step Functions ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:RunTask", "ecs:StopTask", "ecs:DescribeTasks" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region: account-id:rule/StepFunctionsGetEventsForECSTaskRule" ] } ] } Request Response and Callback (.waitForTaskToken) Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", IAM policies 698 AWS Step Functions Developer Guide "Action": [ "ecs:RunTask" ], "Resource": [ "arn:aws:ecs:region: account-id:task-definition/taskDefinition:revisionNumber" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:RunTask" ], "Resource": "*" } ] } If your scheduled Amazon ECS tasks require the use of a task execution role, a task role, or a task role override, then you must add iam:PassRole permissions for each task execution role, task role, or task role override to the CloudWatch Events IAM role of the calling entity, which in this case is Step Functions. Create and manage Amazon EKS clusters with Step Functions Learn how to integrate Step Functions with Amazon EKS to manage Kubernetes clusters. Step Functions provides two types of service integration APIs for integrating with Amazon Elastic Kubernetes Service. One lets you use the Amazon EKS APIs to create and manage an Amazon EKS cluster. The other lets you interact with your cluster using the Kubernetes API and run jobs as part of your application’s workflow. Amazon EKS 699 AWS Step Functions Developer Guide You can use the Kubernetes API integrations with Amazon EKS clusters created using Step Functions, with Amazon EKS clusters created by the eksctl tool or the Amazon EKS console, or similar methods. For more information, see Creating an Amazon EKS cluster in the Amazon EKS User Guide. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized Amazon EKS integration • The
|
step-functions-dg-197
|
step-functions-dg.pdf
| 197 |
using the Kubernetes API and run jobs as part of your application’s workflow. Amazon EKS 699 AWS Step Functions Developer Guide You can use the Kubernetes API integrations with Amazon EKS clusters created using Step Functions, with Amazon EKS clusters created by the eksctl tool or the Amazon EKS console, or similar methods. For more information, see Creating an Amazon EKS cluster in the Amazon EKS User Guide. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized Amazon EKS integration • The Run a Job (.sync) integration pattern is supported. • There are no specific optimizations for the Request Response integration pattern. • The Wait for a Callback with Task Token integration pattern is not supported. Note The Step Functions EKS integration supports only Kubernetes APIs with public endpoint access. By default, EKS clusters API server endpoints have public access. For more information, see Amazon EKS cluster endpoint access control in the Amazon EKS User Guide. Step Functions does not terminate an Amazon EKS cluster automatically if execution is stopped. If your state machine stops before your Amazon EKS cluster has terminated, your cluster may continue running indefinitely, and can accrue additional charges. To avoid this, ensure that any Amazon EKS cluster you create is terminated properly. For more information, see: • Deleting a cluster in the Amazon EKS User Guide. • Run a Job (.sync) in Service Integration Patterns. Quota for input or result data When sending or receiving data between services, the maximum input or result for a task is 256 KiB of data as a UTF-8 encoded string. See Quotas related to state machine executions. Amazon EKS 700 AWS Step Functions Developer Guide Kubernetes API integrations Step Functions supports the following Kubernetes APIs: RunJob The eks:runJob service integration allows you to run a job on your Amazon EKS cluster. The eks:runJob.sync variant allows you to wait for the job to complete, and, optionally retrieve logs. Your Kubernetes API server must grant permissions to the IAM role used by your state machine. For more information, see Permissions. For the Run a Job (.sync) pattern, the status of the job is determined by polling. Step Functions initially polls at a rate of approximately 1 poll per minute. This rate eventually slows to approximately 1 poll every 5 minutes. If you require more frequent polling, or require more control over the polling strategy, you can use the eks:call integration to query the status of the job. The eks:runJob integration is specific to batch/v1 Kubernetes Jobs. For more information, see Jobs in the Kubernetes documentation. If you want to manage other Kubernetes resources, including custom resources, use the eks:call service integration. You can use Step Functions to build polling loops, as demonstrated in the the section called “Job poller” sample project. Supported parameters include: • ClusterName: The name of the Amazon EKS cluster you want to call. • Type: String • Required: yes • CertificateAuthority: The Base64-encoded certificate data required to communicate with your cluster. You can obtain this value from the Amazon EKS console or by using the Amazon EKS DescribeCluster API. • Type: String • Required: yes • Endpoint: The endpoint URL for your Kubernetes API server. You can obtain this value from the Amazon EKS console or by using the Amazon EKS DescribeCluster API. • Type: String • Required: yes Kubernetes API integrations 701 AWS Step Functions Developer Guide • Namespace: The namespace in which to run the job. If not provided, the namespace default is used. • Type: String • Required: no • Job: The definition of the Kubernetes Job. See Jobs in the Kubernetes documentation. • Type: JSON or String • Required: yes • LogOptions: A set of options to control the optional retrieval of logs. Only applicable if the Run a Job (.sync) service integration pattern is used to wait for the completion of the job. • Type: JSON • Required: no • Logs are included in the response under the key logs. There may be multiple pods within the job, each with multiple containers. { ... "logs": { "pods": { "pod1": { "containers": { "container1": { "log": <log> }, ... } }, ... } } • Log retrieval is performed on a best-effort basis. If there is an error retrieving a log, in place of the log field there will be the fields error and cause. • LogOptions.RetrieveLogs: Enable log retrieval after the job completes. By default, logs are not retrieved. • Type: Boolean • Required: no Kubernetes API integrations 702 AWS Step Functions Developer Guide • LogOptions.RawLogs: If RawLogs is set to true, logs will be returned as raw strings without attempting to parse them into JSON. By default, logs are deserialized into JSON if
|
step-functions-dg-198
|
step-functions-dg.pdf
| 198 |
"log": <log> }, ... } }, ... } } • Log retrieval is performed on a best-effort basis. If there is an error retrieving a log, in place of the log field there will be the fields error and cause. • LogOptions.RetrieveLogs: Enable log retrieval after the job completes. By default, logs are not retrieved. • Type: Boolean • Required: no Kubernetes API integrations 702 AWS Step Functions Developer Guide • LogOptions.RawLogs: If RawLogs is set to true, logs will be returned as raw strings without attempting to parse them into JSON. By default, logs are deserialized into JSON if possible. In some cases such parsing can introduce unwanted changes, such as limiting the precision of numbers containing many digits. • Type: Boolean • Required: no • LogOptions.LogParameters: The Kubernetes API’s Read Log API supports query parameters to control log retrieval. For example, you can use tailLines or limitBytes to limit the size of retrieved logs and remain within the Step Functions data size quota. For more information, see the Read Log section of the Kubernetes API Reference. • Type: Map of String to List of Strings • Required: no • Example: "LogParameters": { "tailLines": [ "6" ] } The following example includes a Task state that runs a job, waits for it to complete, then retrieves the job’s logs: { "StartAt": "Run a job on EKS", "States": { "Run a job on EKS": { "Type": "Task", "Resource": "arn:aws:states:::eks:runJob.sync", "Arguments": { "ClusterName": "MyCluster", "CertificateAuthority": "ANPAJ2UCCR6DPCEXAMPLE", "Endpoint": "https://AKIAIOSFODNN7EXAMPLE.yl4.us-east-1.eks.amazonaws.com", "LogOptions": { "RetrieveLogs": true }, "Job": { "apiVersion": "batch/v1", "kind": "Job", "metadata": { Kubernetes API integrations 703 AWS Step Functions Developer Guide "name": "example-job" }, "spec": { "backoffLimit": 0, "template": { "metadata": { "name": "example-job" }, "spec": { "containers": [ { "name": "pi-2000", "image": "perl", "command": [ "perl" ], "args": [ "-Mbignum=bpi", "-wle", "print bpi(2000)" ] } ], "restartPolicy": "Never" } } } } }, "End": true } } } Call The eks:call service integration allows you to use the Kubernetes API to read and write Kubernetes resource objects via a Kubernetes API endpoint. Your Kubernetes API server must grant permissions to the IAM role used by your state machine. For more information, see Permissions. For more information about the available operations, see the Kubernetes API Reference. Supported parameters for Call include: Kubernetes API integrations 704 AWS Step Functions Developer Guide • ClusterName: The name of the Amazon EKS cluster you want to call. • Type: String • Required: Yes • CertificateAuthority: The Base64-encoded certificate data required to communicate with your cluster. You can obtain this value from the Amazon EKS console or by using the Amazon EKS DescribeCluster API. • Type: String • Required: Yes • Endpoint: The endpoint URL for your Kubernetes API server. You can find this value on the Amazon EKS console or by using Amazon EKS’ DescribeCluster API. • Type: String • Required: Yes • Method: The HTTP method of your request. One of: GET, POST, PUT, DELETE, HEAD, or PATCH. • Type: String • Required: Yes • Path: The HTTP path of the Kubernetes REST API operation. • Type: String • Required: Yes • QueryParameters: The HTTP query parameters of the Kubernetes REST API operation. • Type: Map of String to List of Strings • Required: No • Example: "QueryParameters": { "labelSelector": [ "job-name=example-job" ] } • RequestBody: The HTTP message body of the Kubernetes REST API operation. • Type: JSON or String • Required: No The following includes a Task state that uses eks:call to list the pods belonging to the job example-job. Kubernetes API integrations 705 AWS Step Functions Developer Guide { "StartAt": "Call EKS", "States": { "Call EKS": { "Type": "Task", "Resource": "arn:aws:states:::eks:call", "Arguments": { "ClusterName": "MyCluster", "CertificateAuthority": "ANPAJ2UCCR6DPCEXAMPLE", "Endpoint": "https://444455556666.yl4.us-east-1.eks.amazonaws.com", "Method": "GET", "Path": "/api/v1/namespaces/default/pods", "QueryParameters": { "labelSelector": [ "job-name=example-job" ] } }, "End": true } } } The following includes a Task state that uses eks:call to delete the job example-job, and sets the propagationPolicy to ensure the job's pods are also deleted. { "StartAt": "Call EKS", "States": { "Call EKS": { "Type": "Task", "Resource": "arn:aws:states:::eks:call", "Arguments": { "ClusterName": "MyCluster", "CertificateAuthority": "ANPAJ2UCCR6DPCEXAMPLE", "Endpoint": "https://444455556666.yl4.us-east-1.eks.amazonaws.com", "Method": "DELETE", "Path": "/apis/batch/v1/namespaces/default/jobs/example-job", "QueryParameters": { "propagationPolicy": [ "Foreground" ] } Kubernetes API integrations 706 Developer Guide AWS Step Functions }, "End": true } } } Optimized Amazon EKS APIs Supported Amazon EKS APIs and syntax include: • CreateCluster • Request syntax • Response syntax When an Amazon EKS cluster is created using the eks:createCluster service integration, the IAM role is added to the Kubernetes RBAC authorization table as the administrator (with system:masters permissions). Initially, only that IAM entity can make calls to the Kubernetes API server. For more information, see: • Managing users or IAM roles for your cluster in the Amazon EKS User Guide • The Permissions section Amazon EKS uses service-linked roles which contain the permissions
|
step-functions-dg-199
|
step-functions-dg.pdf
| 199 |
Functions }, "End": true } } } Optimized Amazon EKS APIs Supported Amazon EKS APIs and syntax include: • CreateCluster • Request syntax • Response syntax When an Amazon EKS cluster is created using the eks:createCluster service integration, the IAM role is added to the Kubernetes RBAC authorization table as the administrator (with system:masters permissions). Initially, only that IAM entity can make calls to the Kubernetes API server. For more information, see: • Managing users or IAM roles for your cluster in the Amazon EKS User Guide • The Permissions section Amazon EKS uses service-linked roles which contain the permissions Amazon EKS requires to call other services on your behalf. If these service-linked roles do not exist in your account already, you must add the iam:CreateServiceLinkedRole permission to the IAM role used by Step Functions. For more information, see Using Service-Linked Roles in the Amazon EKS User Guide. The IAM role used by Step Functions must have iam:PassRole permissions to pass the cluster IAM role to Amazon EKS. For more information, see Amazon EKS cluster IAM role in the Amazon EKS User Guide. • DeleteCluster • Request syntax • Response syntax You must delete any Fargate profiles or node groups before deleting a cluster. • CreateFargateProfile • Request syntax Optimized Amazon EKS APIs 707 AWS Step Functions • Response syntax Developer Guide Amazon EKS uses service-linked roles which contain the permissions Amazon EKS requires to call other services on your behalf. If these service-linked roles do not exist in your account already, you must add the iam:CreateServiceLinkedRole permission to the IAM role used by Step Functions. For more information, see Using Service-Linked Roles in the Amazon EKS User Guide. Amazon EKS on Fargate may not be available in all regions. For information on region availability, see the section on Fargate in the Amazon EKS User Guide. The IAM role used by Step Functions must have iam:PassRole permissions to pass the pod execution IAM role to Amazon EKS. For more information, see Pod execution role in the Amazon EKS User Guide. • DeleteFargateProfile • Request syntax • Response syntax • CreateNodegroup • Request syntax • Response syntax Amazon EKS uses service-linked roles which contain the permissions Amazon EKS requires to call other services on your behalf. If these service-linked roles do not exist in your account already, you must add the iam:CreateServiceLinkedRole permission to the IAM role used by Step Functions. For more information, see Using Service-Linked Roles in the Amazon EKS User Guide. The IAM role used by Step Functions must have iam:PassRole permissions to pass the node IAM role to Amazon EKS. For more information, see Using Service-Linked Roles in the Amazon EKS User Guide. • DeleteNodegroup • Request syntax • Response syntax The following includes a Task that creates an Amazon EKS cluster. Optimized Amazon EKS APIs 708 AWS Step Functions Developer Guide { "StartAt": "CreateCluster.sync", "States": { "CreateCluster.sync": { "Type": "Task", "Resource": "arn:aws:states:::eks:createCluster.sync", "Arguments": { "Name": "MyCluster", "ResourcesVpcConfig": { "SubnetIds": [ "subnet-053e7c47012341234", "subnet-027cfea4b12341234" ] }, "RoleArn": "arn:aws:iam::account-id:role/MyEKSClusterRole" }, "End": true } } } The following includes a Task state that deletes an Amazon EKS cluster. { "StartAt": "DeleteCluster.sync", "States": { "DeleteCluster.sync": { "Type": "Task", "Resource": "arn:aws:states:::eks:deleteCluster.sync", "Arguments": { "Name": "MyCluster" }, "End": true } } } The following includes a Task state that creates a Fargate profile. { "StartAt": "CreateFargateProfile.sync", "States": { Optimized Amazon EKS APIs 709 AWS Step Functions Developer Guide "CreateFargateProfile.sync": { "Type": "Task", "Resource": "arn:aws:states:::eks:createFargateProfile.sync", "Arguments": { "ClusterName": "MyCluster", "FargateProfileName": "MyFargateProfile", "PodExecutionRoleArn": "arn:aws:iam::account-id:role/ MyFargatePodExecutionRole", "Selectors": [{ "Namespace": "my-namespace", "Labels": { "my-label": "my-value" } }] }, "End": true } } } The following includes a Task state that deletes a Fargate profile. { "StartAt": "DeleteFargateProfile.sync", "States": { "DeleteFargateProfile.sync": { "Type": "Task", "Resource": "arn:aws:states:::eks:deleteFargateProfile.sync", "Arguments": { "ClusterName": "MyCluster", "FargateProfileName": "MyFargateProfile" }, "End": true } } } The following includes a Task state that creates a node group. { "StartAt": "CreateNodegroup.sync", "States": { "CreateNodegroup.sync": { "Type": "Task", "Resource": "arn:aws:states:::eks:createNodegroup.sync", Optimized Amazon EKS APIs 710 AWS Step Functions "Arguments": { "ClusterName": "MyCluster", "NodegroupName": "MyNodegroup", "NodeRole": "arn:aws:iam::account-id:role/MyNodeInstanceRole", "Subnets": ["subnet-09fb51df01234", "subnet-027cfea4b1234"] Developer Guide }, "End": true } } } The following includes a Task state that deletes a node group. { "StartAt": "DeleteNodegroup.sync", "States": { "DeleteNodegroup.sync": { "Type": "Task", "Resource": "arn:aws:states:::eks:deleteNodegroup.sync", "Arguments": { "ClusterName": "MyCluster", "NodegroupName": "MyNodegroup" }, "End": true } } } Permissions When an Amazon EKS cluster is created using the eks:createCluster service integration, the IAM role is added to the Kubernetes RBAC authorization table as the administrator, with system:masters permissions. Initially, only that IAM entity can make calls to the Kubernetes API server. For example, you will not be able to use kubectl to interact with your Kubernetes API server, unless you assume the same role as your Step Functions state machine, or if you configure Kubernetes to grant permissions to additional IAM entities. For more information,
|
step-functions-dg-200
|
step-functions-dg.pdf
| 200 |
"arn:aws:states:::eks:deleteNodegroup.sync", "Arguments": { "ClusterName": "MyCluster", "NodegroupName": "MyNodegroup" }, "End": true } } } Permissions When an Amazon EKS cluster is created using the eks:createCluster service integration, the IAM role is added to the Kubernetes RBAC authorization table as the administrator, with system:masters permissions. Initially, only that IAM entity can make calls to the Kubernetes API server. For example, you will not be able to use kubectl to interact with your Kubernetes API server, unless you assume the same role as your Step Functions state machine, or if you configure Kubernetes to grant permissions to additional IAM entities. For more information, see Managing users or IAM roles for your cluster in the Amazon EKS User Guide. You can add permission for additional IAM entities, such as users or roles, by adding them to the aws-auth ConfigMap in the kube-system namespace. If you are creating your cluster from Step Functions, use the eks:call service integration. Permissions 711 AWS Step Functions Developer Guide The following includes a Task state that creates an aws-auth ConfigMap and grants system:masters permission to the user arn:aws:iam::account-id:user/my-user and the IAM role arn:aws:iam::account-id:role/my-role. { "StartAt": "Add authorized user", "States": { "Add authorized user": { "Type": "Task", "Resource": "arn:aws:states:::eks:call", "Arguments": { "ClusterName": "MyCluster", "CertificateAuthority": "LS0tLS1CRUd...UtLS0tLQo=", "Endpoint": "https://444455556666.yl4.region.eks.amazonaws.com", "Method": "POST", "Path": "/api/v1/namespaces/kube-system/configmaps", "RequestBody": { "apiVersion": "v1", "kind": "ConfigMap", "metadata": { "name": "aws-auth", "namespace": "kube-system" }, "data": { "mapUsers": "[{ \"userarn\": \"arn:aws:iam::account-id:user/my-user\", \"username\": \"my-user\", \"groups\": [ \"system:masters\" ] } ]", "mapRoles": "[{ \"rolearn\": \"arn:aws:iam::account-id:role/my-role\", \"username\": \"my-role\", \"groups\": [ \"system:masters\" ] } ]" } } }, "End": true } } Note You may see the ARN for an IAM role displayed in a format that includes the path /service- role/, such as arn:aws:iam::account-id:role/service-role/my-role. This service-role path token should not be included when listing the role in aws-auth. Permissions 712 AWS Step Functions Developer Guide When your cluster is first created the aws-auth ConfigMap will not exist, but will be added automatically if you create a Fargate profile. You can retrieve the current value of aws-auth, add the additional permissions, and PUT a new version. It is usually easier to create aws-auth before the Fargate profile. If your cluster was created outside of Step Functions, you can configure kubectl to communicate with your Kubernetes API server. Then, create a new aws-auth ConfigMap using kubectl apply -f aws-auth.yaml or edit one that already exists using kubectl edit -n kube-system configmap/aws-auth. For more information, see: • Create a kubeconfig for Amazon EKS in the Amazon EKS User Guide. • Managing users or IAM roles for your cluster in the Amazon EKS User Guide. If your IAM role does not have sufficient permissions in Kubernetes, the eks:call or eks:runJob service integrations will fail with the following error: Error: EKS.401 Cause: { "ResponseBody": { "kind": "Status", "apiVersion": "v1", "metadata": {}, "status": "Failure", "message": "Unauthorized", "reason": "Unauthorized", "code": 401 }, "StatusCode": 401, "StatusText": "Unauthorized" } IAM policies for calling Amazon EKS The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions IAM policies 713 AWS Step Functions Developer Guide generates IAM policies for integrated services and Discover service integration patterns in Step Functions. CreateCluster Resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "eks:CreateCluster" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "eks:DescribeCluster", "eks:DeleteCluster" ], "Resource": "arn:aws:eks:sa-east-1:444455556666:cluster/*" }, { "Effect": "Allow", "Action": "iam:PassRole", "Resource": [ "arn:aws:iam::444455556666:role/StepFunctionsSample-EKSClusterManag- EKSServiceRole-ANPAJ2UCCR6DPCEXAMPLE" ], "Condition": { "StringEquals": { "iam:PassedToService": "eks.amazonaws.com" } } } ] } IAM policies 714 Developer Guide AWS Step Functions CreateNodeGroup Resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:DescribeSubnets", "eks:CreateNodegroup" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "eks:DescribeNodegroup", "eks:DeleteNodegroup" ], "Resource": "arn:aws:eks:sa-east-1:444455556666:nodegroup/*" }, { "Effect": "Allow", "Action": [ "iam:GetRole", "iam:ListAttachedRolePolicies" ], "Resource": "arn:aws:iam::444455556666:role/*" }, { "Effect": "Allow", "Action": "iam:PassRole", "Resource": [ "arn:aws:iam::444455556666:role/StepFunctionsSample-EKSClusterMan- NodeInstanceRole-ANPAJ2UCCR6DPCEXAMPLE" ], "Condition": { "StringEquals": { "iam:PassedToService": "eks.amazonaws.com" } } } IAM policies 715 Developer Guide AWS Step Functions ] } DeleteCluster Resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "eks:DeleteCluster", "eks:DescribeCluster" ], "Resource": [ "arn:aws:eks:sa-east-1:444455556666:cluster/ExampleCluster" ] } ] } DeleteNodegroup Resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "eks:DeleteNodegroup", "eks:DescribeNodegroup" ], "Resource": [ "arn:aws:eks:sa-east-1:444455556666:nodegroup/ExampleCluster/ ExampleNodegroup/*" ] } ] IAM policies 716 AWS Step Functions } Developer Guide For more information about using Amazon EKS with Step Functions, see Create and manage Amazon EKS clusters with Step Functions. Create and manage Amazon EMR clusters with Step Functions Learn how to integrate AWS Step Functions with Amazon EMR using the provided Amazon EMR service integration APIs. The service integration APIs are similar to the corresponding Amazon EMR APIs, with some differences in the fields that are passed and in the responses that are returned. To learn about integrating with AWS services in Step Functions, see Integrating services and
|
step-functions-dg-201
|
step-functions-dg.pdf
| 201 |
} ] IAM policies 716 AWS Step Functions } Developer Guide For more information about using Amazon EKS with Step Functions, see Create and manage Amazon EKS clusters with Step Functions. Create and manage Amazon EMR clusters with Step Functions Learn how to integrate AWS Step Functions with Amazon EMR using the provided Amazon EMR service integration APIs. The service integration APIs are similar to the corresponding Amazon EMR APIs, with some differences in the fields that are passed and in the responses that are returned. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized Amazon EMR integration • The Optimized Amazon EMR service integration has a customized set of APIs that wrap the underlying Amazon EMR APIs, described below. Because of this, it differs significantly from the Amazon EMR AWS SDK service integration. • The Run a Job (.sync) integration pattern is supported. Step Functions does not terminate an Amazon EMR cluster automatically if execution is stopped. If your state machine stops before your Amazon EMR cluster has terminated, your cluster may continue running indefinitely, and can accrue additional charges. To avoid this, ensure that any Amazon EMR cluster you create is terminated properly. For more information, see: • Control Cluster Termination in the Amazon EMR User Guide. • The Service Integration Patterns Run a Job (.sync) section. Note As of emr-5.28.0, you can specify the parameter StepConcurrencyLevel when creating a cluster to allow multiple steps to run in parallel on a single cluster. You can use the Step Functions Map and Parallel states to submit work in parallel to the cluster. Amazon EMR 717 AWS Step Functions Developer Guide The availability of Amazon EMR service integration is subject to the availability of Amazon EMR APIs. See Amazon EMR documentation for limitations in special regions. Note For integration with Amazon EMR, Step Functions has a hard-coded 60 seconds job polling frequency for the first 10 minutes and 300 seconds after that. Optimized Amazon EMR APIs The following table describes the differences between each Amazon EMR service integration API and corresponding Amazon EMR APIs. Amazon EMR Service Integration API Corresponding EMR API Differences createCluster runJobFlow Creates and starts running a cluster (job flow). Amazon EMR is linked directly to a unique type of IAM role known as a service-l inked role. For createClu ster and createClu ster.sync to work, you must have configured the necessary permissions to create the service-linked role AWSServiceRoleForE MRCleanup . For more information about this, including a statement you can add to your IAM permissions policy, see Using the Service-L inked Role for Amazon EMR. createCluster uses the same request syntax as runJobFlow, except for the following: • The field Instances .KeepJobFlowAliveW henNoSteps mandatory, and must have is the Boolean value TRUE. • The field Steps is not allowed. • The field Instances .InstanceFleets[in dex].Name should be provided and must be unique if the optional modifyInstanceFlee tByName connector API is used. Supported APIs 718 AWS Step Functions Amazon EMR Service Integration API Corresponding EMR API Differences Developer Guide • The field Instances .InstanceGroups[in dex].Name should be provided and must be unique if the optional modifyInstanceGrou pByName API is used. Response is this: { "ClusterId": "string" } Amazon EMR uses this: { "JobFlowId": "string" } The same as createClu ster , but waits for the cluster to reach the WAITING state. createCluster.sync runJobFlow Creates and starts running a cluster (job flow). Supported APIs 719 AWS Step Functions Amazon EMR Service Integration API setClusterTerminationProtec tion Locks a cluster (job flow) so the EC2 instances in the cluster cannot be terminate d by user intervention, an API call, or a job-flow error. Developer Guide Corresponding EMR API Differences setTerminationProtection Request uses this: { "ClusterId": "string" } Amazon EMR uses this: { "JobFlowIds": ["string"] } terminateCluster terminateJobFlows Request uses this: Shuts down a cluster (job flow). terminateCluster.sync terminateJobFlows Shuts down a cluster (job flow). { "ClusterId": "string" } Amazon EMR uses this: { "JobFlowIds": ["string"] } The same as terminate Cluster , but waits for the cluster to terminate. Supported APIs 720 AWS Step Functions Amazon EMR Service Integration API Corresponding EMR API Differences Developer Guide addStep addJobFlowSteps Request uses the key Adds a new step to a running cluster. Optionally, you can also specify the Execution RoleArn parameter while using this API. "ClusterId" . Amazon EMR uses "JobFlowId" . Request uses a single step. { "Step": <"StepConfig object"> } Amazon EMR uses this: { "Steps": [<StepConfig objects>] } Response is this: { "StepId": "string" } Amazon EMR returns this: { "StepIds": [<strings >] } Supported APIs 721 AWS Step Functions Amazon EMR Service Integration API Corresponding EMR API Differences Developer Guide addStep.sync addJobFlowSteps Adds a new step to a running cluster.
|
step-functions-dg-202
|
step-functions-dg.pdf
| 202 |
API Differences Developer Guide addStep addJobFlowSteps Request uses the key Adds a new step to a running cluster. Optionally, you can also specify the Execution RoleArn parameter while using this API. "ClusterId" . Amazon EMR uses "JobFlowId" . Request uses a single step. { "Step": <"StepConfig object"> } Amazon EMR uses this: { "Steps": [<StepConfig objects>] } Response is this: { "StepId": "string" } Amazon EMR returns this: { "StepIds": [<strings >] } Supported APIs 721 AWS Step Functions Amazon EMR Service Integration API Corresponding EMR API Differences Developer Guide addStep.sync addJobFlowSteps Adds a new step to a running cluster. Optionally, you can also specify the Execution RoleArn parameter while using this API. The same as addStep, but waits for the step to complete. Supported APIs 722 AWS Step Functions Amazon EMR Service Integration API Corresponding EMR API Differences Developer Guide cancelStep cancelSteps Request uses this: Cancels a pending step in a running cluster. { "StepId": "string" } Amazon EMR uses this: { "StepIds": [<strings >] } Response is this: { "CancelStepsInfo": <CancelStepsInfo object> } Amazon EMR uses this: { "CancelStepsInfoLi st": [<CancelStepsInfo objects>] } Supported APIs 723 AWS Step Functions Amazon EMR Service Integration API Corresponding EMR API Differences Developer Guide modifyInstanceFleetByName modifyInstanceFleet Request is the same as for Modifies the target On- Demand and target Spot capacities for the instance fleet with the specified InstanceFleetName . modifyInstanceFleet , except for the following: • The field Instance. InstanceFleetId is not allowed. • At runtime the InstanceF leetId is determined automatically by the service integration by calling ListInstanceFleets and parsing the result. Supported APIs 724 AWS Step Functions Amazon EMR Service Integration API Corresponding EMR API Differences Developer Guide modifyInstanceGroupByName modifyInstanceGroups Request is this: Modifies the number of nodes and configuration settings of an instance group. { "ClusterId": "string", "InstanceGroup": <InstanceGroupModi fyConfig object> } Amazon EMR uses a list: { "ClusterId": ["string"], "InstanceGroups": [<InstanceGroupMod ifyConfig objects>] } Within the InstanceG roupModifyConfig object, the field InstanceG roupId is not allowed. A new field, InstanceG roupName , has been added. At runtime the InstanceG roupId is determine d automatically by the service integration by calling ListInstanceGroups and parsing the result. Supported APIs 725 AWS Step Functions Workflow example Developer Guide The following includes a Task state that creates a cluster. "Create_Cluster": { "Type": "Task", "Resource": "arn:aws:states:::elasticmapreduce:createCluster.sync", "Arguments": { "Name": "MyWorkflowCluster", "VisibleToAllUsers": true, "ReleaseLabel": "emr-5.28.0", "Applications": [ { "Name": "Hive" } ], "ServiceRole": "EMR_DefaultRole", "JobFlowRole": "EMR_EC2_DefaultRole", "LogUri": "s3n://aws-logs-account-id-us-east-1/elasticmapreduce/", "Instances": { "KeepJobFlowAliveWhenNoSteps": true, "InstanceFleets": [ { "InstanceFleetType": "MASTER", "Name": "MASTER", "TargetOnDemandCapacity": 1, "InstanceTypeConfigs": [ { "InstanceType": "m4.xlarge" } ] }, { "InstanceFleetType": "CORE", "Name": "CORE", "TargetOnDemandCapacity": 1, "InstanceTypeConfigs": [ { "InstanceType": "m4.xlarge" } ] } ] Examples 726 AWS Step Functions } }, "End": true } Developer Guide The following includes a Task state that enables termination protection. "Enable_Termination_Protection": { "Type": "Task", "Resource": "arn:aws:states:::elasticmapreduce:setClusterTerminationProtection", "Arguments": { "ClusterId": "{% $ClusterId %}", "TerminationProtected": true }, "End": true } The following includes a Task state that submits a step to a cluster. "Step_One": { "Type": "Task", "Resource": "arn:aws:states:::elasticmapreduce:addStep.sync", "Arguments": { "ClusterId": "{% $ClusterId %}", "ExecutionRoleArn": "arn:aws:iam::account-id:role/myEMR-execution-role", "Step": { "Name": "The first step", "ActionOnFailure": "CONTINUE", "HadoopJarStep": { "Jar": "command-runner.jar", "Args": [ "hive-script", "--run-hive-script", "--args", "-f", "s3://region.elasticmapreduce.samples/cloudfront/code/ Hive_CloudFront.q", "-d", "INPUT=s3://region.elasticmapreduce.samples", "-d", "OUTPUT=s3://<amzn-s3-demo-bucket>/MyHiveQueryResults/" ] } Examples 727 AWS Step Functions } }, "End": true } Developer Guide The following includes a Task state that cancels a step. "Cancel_Step_One": { "Type": "Task", "Resource": "arn:aws:states:::elasticmapreduce:cancelStep", "Arguments": { "ClusterId": "{% $ClusterId %}", "StepId": "{% $AddStepsResult.StepId %}" }, "End": true } The following includes a Task state that terminates a cluster. "Terminate_Cluster": { "Type": "Task", "Resource": "arn:aws:states:::elasticmapreduce:terminateCluster.sync", "Arguments": { "ClusterId": "{% $ClusterId %}", }, "End": true } The following includes a Task state that scales a cluster up or down for an instance group. "ModifyInstanceGroupByName": { "Type": "Task", "Resource": "arn:aws:states:::elasticmapreduce:modifyInstanceGroupByName", "Arguments": { "ClusterId": "j-account-id3", "InstanceGroupName": "MyCoreGroup", "InstanceGroup": { "InstanceCount": 8 } }, "End": true Examples 728 AWS Step Functions } Developer Guide The following includes a Task state that scales a cluster up or down for an instance fleet. "ModifyInstanceFleetByName": { "Type": "Task", "Resource": "arn:aws:states:::elasticmapreduce:modifyInstanceFleetByName", "Arguments": { "ClusterId": "j-account-id3", "InstanceFleetName": "MyCoreFleet", "InstanceFleet": { "TargetOnDemandCapacity": 8, "TargetSpotCapacity": 0 } }, "End": true } IAM policies for calling Amazon EMR The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. addStep Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:AddJobFlowSteps", "elasticmapreduce:DescribeStep", "elasticmapreduce:CancelSteps" ], "Resource": [ "arn:aws:elasticmapreduce:[[region]]:[[accountId]]:cluster/[[clusterId]]" ] IAM policies 729 Developer Guide AWS Step Functions } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:AddJobFlowSteps", "elasticmapreduce:DescribeStep", "elasticmapreduce:CancelSteps" ], "Resource": "arn:aws:elasticmapreduce:*:*:cluster/*" } ] } cancelStep Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow",
|
step-functions-dg-203
|
step-functions-dg.pdf
| 203 |
AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. addStep Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:AddJobFlowSteps", "elasticmapreduce:DescribeStep", "elasticmapreduce:CancelSteps" ], "Resource": [ "arn:aws:elasticmapreduce:[[region]]:[[accountId]]:cluster/[[clusterId]]" ] IAM policies 729 Developer Guide AWS Step Functions } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:AddJobFlowSteps", "elasticmapreduce:DescribeStep", "elasticmapreduce:CancelSteps" ], "Resource": "arn:aws:elasticmapreduce:*:*:cluster/*" } ] } cancelStep Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "elasticmapreduce:CancelSteps", "Resource": [ "arn:aws:elasticmapreduce:region:account-id:cluster/cluster-id" ] } ] } Dynamic resources { "Version": "2012-10-17", IAM policies 730 AWS Step Functions Developer Guide "Statement": [ { "Effect": "Allow", "Action": "elasticmapreduce:CancelSteps", "Resource": "arn:aws:elasticmapreduce:*:*:cluster/*" } ] } createCluster Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:RunJobFlow", "elasticmapreduce:DescribeCluster", "elasticmapreduce:TerminateJobFlows" ], "Resource": "*" }, { "Effect": "Allow", "Action": "iam:PassRole", "Resource": [ "arn:aws:iam::account-id:role/roleName" ] } ] } setClusterTerminationProtection Static resources { "Version": "2012-10-17", "Statement": [ IAM policies 731 AWS Step Functions { Developer Guide "Effect": "Allow", "Action": "elasticmapreduce:SetTerminationProtection", "Resource": [ "arn:aws:elasticmapreduce:region:account-id:cluster/cluster-id" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "elasticmapreduce:SetTerminationProtection", "Resource": "arn:aws:elasticmapreduce:*:*:cluster/*" } ] } modifyInstanceFleetByName Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:ModifyInstanceFleet", "elasticmapreduce:ListInstanceFleets" ], "Resource": [ "arn:aws:elasticmapreduce:region:account-id:cluster/cluster-id" ] } ] } IAM policies 732 Developer Guide AWS Step Functions Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:ModifyInstanceFleet", "elasticmapreduce:ListInstanceFleets" ], "Resource": "arn:aws:elasticmapreduce:*:*:cluster/*" } ] } modifyInstanceGroupByName Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:ModifyInstanceGroups", "elasticmapreduce:ListInstanceGroups" ], "Resource": [ "arn:aws:elasticmapreduce:region:account-id:cluster/cluster-id" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", IAM policies 733 AWS Step Functions "Action": [ "elasticmapreduce:ModifyInstanceGroups", "elasticmapreduce:ListInstanceGroups" Developer Guide ], "Resource": "*" } ] } terminateCluster Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:TerminateJobFlows", "elasticmapreduce:DescribeCluster" ], "Resource": [ "arn:aws:elasticmapreduce:region:account-id:cluster/cluster-id" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "elasticmapreduce:TerminateJobFlows", "elasticmapreduce:DescribeCluster" ], "Resource": "arn:aws:elasticmapreduce:*:*:cluster/*" } ] IAM policies 734 AWS Step Functions } Developer Guide Create and manage Amazon EMR clusters on EKS with AWS Step Functions Learn how to integrate AWS Step Functions with Amazon EMR on EKS using the Amazon EMR on EKS service integration APIs. The service integration APIs are the same as the corresponding Amazon EMR on EKS APIs, but not all APIs support all integration patterns, as shown in the following table. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. How the Optimized Amazon EMR on EKS integration is different than the Amazon EMR on EKS AWS SDK integration • The Run a Job (.sync) integration pattern is supported. • There are no specific optimizations for the Request Response integration pattern. • The Wait for a Callback with Task Token integration pattern is not supported. Note For integration with Amazon EMR, Step Functions has a hard-coded 60 seconds job polling frequency for the first 10 minutes and 300 seconds after that. API Request response Run a job (.sync) CreateVirtualCluster Supported Not supported DeleteVirtualCluster Supported StartJobRun Supported Supported Supported Supported Amazon EMR on EKS APIs: Amazon EMR on EKS 735 AWS Step Functions Developer Guide Quota for input or result data When sending or receiving data between services, the maximum input or result for a task is 256 KiB of data as a UTF-8 encoded string. See Quotas related to state machine executions. • CreateVirtualCluster • Request syntax • Supported parameters • Response syntax • DeleteVirtualCluster • Request syntax • Supported parameters • Response syntax • StartJobRun • Request syntax • Supported parameters • Response syntax The following includes a Task state that creates a virtual cluster. "Create_Virtual_Cluster": { "Type": "Task", "Resource": "arn:aws:states:::emr-containers:createVirtualCluster", "Arguments": { "Name": "MyVirtualCluster", "ContainerProvider": { "Id": "EKSClusterName", "Type": "EKS", "Info": { "EksInfo": { "Namespace": "Namespace" } } } }, Amazon EMR on EKS 736 AWS Step Functions "End": true } Developer Guide The following includes a Task state that submits a job to a virtual cluster and waits for it to complete. "Submit_Job": { "Type": "Task", "Resource": "arn:aws:states:::emr-containers:startJobRun.sync", "Arguments": { "Name": "MyJobName", "VirtualClusterId": "{% $VirtualClusterId %}", "ExecutionRoleArn": "arn:aws:iam::<accountId>:role/job-execution-role", "ReleaseLabel": "emr-6.2.0-latest", "JobDriver": { "SparkSubmitJobDriver": { "EntryPoint": "s3://<amzn-s3-demo-bucket>/jobs/trip-count.py", "EntryPointArguments": [ "60" ], "SparkSubmitParameters": "--conf spark.driver.cores=2 --conf spark.executor.instances=10 --conf spark.kubernetes.pyspark.pythonVersion=3 --conf spark.executor.memory=10G --conf spark.driver.memory=10G --conf spark.executor.cores=1 --conf spark.dynamicAllocation.enabled=false" } }, "ConfigurationOverrides": { "ApplicationConfiguration": [ { "Classification": "spark-defaults", "Properties": { "spark.executor.instances": "2", "spark.executor.memory": "2G" } } ], "MonitoringConfiguration": { "PersistentAppUI": "ENABLED", "CloudWatchMonitoringConfiguration": { "LogGroupName": "MyLogGroupName", "LogStreamNamePrefix": "MyLogStreamNamePrefix" }, "S3MonitoringConfiguration": { Amazon EMR on EKS 737 AWS Step Functions Developer Guide "LogUri": "s3://<amzn-s3-demo-logging-bucket1>" } } }, "Tags": { "taskType": "jobName" } }, "End":
|
step-functions-dg-204
|
step-functions-dg.pdf
| 204 |
for it to complete. "Submit_Job": { "Type": "Task", "Resource": "arn:aws:states:::emr-containers:startJobRun.sync", "Arguments": { "Name": "MyJobName", "VirtualClusterId": "{% $VirtualClusterId %}", "ExecutionRoleArn": "arn:aws:iam::<accountId>:role/job-execution-role", "ReleaseLabel": "emr-6.2.0-latest", "JobDriver": { "SparkSubmitJobDriver": { "EntryPoint": "s3://<amzn-s3-demo-bucket>/jobs/trip-count.py", "EntryPointArguments": [ "60" ], "SparkSubmitParameters": "--conf spark.driver.cores=2 --conf spark.executor.instances=10 --conf spark.kubernetes.pyspark.pythonVersion=3 --conf spark.executor.memory=10G --conf spark.driver.memory=10G --conf spark.executor.cores=1 --conf spark.dynamicAllocation.enabled=false" } }, "ConfigurationOverrides": { "ApplicationConfiguration": [ { "Classification": "spark-defaults", "Properties": { "spark.executor.instances": "2", "spark.executor.memory": "2G" } } ], "MonitoringConfiguration": { "PersistentAppUI": "ENABLED", "CloudWatchMonitoringConfiguration": { "LogGroupName": "MyLogGroupName", "LogStreamNamePrefix": "MyLogStreamNamePrefix" }, "S3MonitoringConfiguration": { Amazon EMR on EKS 737 AWS Step Functions Developer Guide "LogUri": "s3://<amzn-s3-demo-logging-bucket1>" } } }, "Tags": { "taskType": "jobName" } }, "End": true } The following includes a Task state that deletes a virtual cluster and waits for the deletion to complete. "Delete_Virtual_Cluster": { "Type": "Task", "Resource": "arn:aws:states:::emr-containers:deleteVirtualCluster.sync", "Arguments": { "Id": "{% $states.input.VirtualClusterId %}", }, "End": true } To learn about configuring IAM permissions when using Step Functions with other AWS services, see How Step Functions generates IAM policies for integrated services. Create and manage Amazon EMR Serverless applications with Step Functions Learn how to create, start, stop, and delete applications on EMR Serverless using Step Functions. This page lists the supported APIs and provides example Task states to perform common use cases. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Amazon EMR Serverless 738 AWS Step Functions Developer Guide Key features of Optimized EMR Serverless integration • The Optimized EMR Serverless service integration has a customized set of APIs that wrap the underlying EMR Serverless APIs. Because of this customization, the optimized EMR Serverless integration differs significantly from the AWS SDK service integration. • In addition, the optimized EMR Serverless integration supports Run a Job (.sync) integration pattern. • The Wait for a Callback with Task Token integration pattern is not supported. EMR Serverless service integration APIs To integrate AWS Step Functions with EMR Serverless, you can use the following six EMR Serverless service integration APIs. These service integration APIs are similar to the corresponding EMR Serverless APIs, with some differences in the fields that are passed and in the responses that are returned. The following table describes the differences between each EMR Serverless service integration API and its corresponding EMR Serverless API. EMR Serverless service integration API Corresponding EMR Serverless API Differences createApplication CreateApplication None Creates an application. EMR Serverless is linked to a unique type of IAM role known as a service-l inked role. For createApp lication and createApp to work, lication.sync you must have configured the necessary permissions to create the service-linked role AWSServiceRoleForA Service integration APIs 739 AWS Step Functions Developer Guide EMR Serverless service integration API Corresponding EMR Serverless API Differences mazonEMRServerless For more information about this, including a statement . you can add to your IAM permissions policy, see Using service-linked roles for EMR Serverless. createApplication.sync CreateApplication Creates an application. startApplication StartApplication Starts a specified application and initializes the applicati on's initial capacity if configured. No differences between the requests and responses of the EMR Serverless API and EMR Serverless service integrati on API. However, createApp lication.sync waits for the application to reach the CREATED state. The EMR Serverless API response doesn't contain any data, but the EMR Serverless service integrati on API response includes the following data. { "ApplicationId": "string" } Service integration APIs 740 AWS Step Functions Developer Guide EMR Serverless service integration API Corresponding EMR Serverless API Differences startApplication.sync StartApplication Starts a specified applicati on and initializes the initial capacity if configured. stopApplication StopApplication Stops a specified application and releases initial capacity if configured. All scheduled and running jobs must be completed or cancelled before stopping an applicati on. The EMR Serverless API response doesn't contain any data, but the EMR Serverless service integrati on API response includes the following data. { "ApplicationId": "string" } Also, startApplication.sync waits for the application to reach the STARTED state. The EMR Serverless API response doesn't contain any data, but the EMR Serverless service integrati on API response includes the following data. { "ApplicationId": "string" } Service integration APIs 741 AWS Step Functions Developer Guide EMR Serverless service integration API Corresponding EMR Serverless API Differences stopApplication.sync StopApplication Stops a specified application and releases initial capacity if configured. All scheduled and running jobs must be completed or cancelled before stopping an applicati on. deleteApplication DeleteApplication Deletes an application. An application must be in the STOPPED or CREATED state in order to be deleted. The EMR Serverless API response doesn't contain any data, but the EMR Serverless service integrati on API response includes the following data. { "ApplicationId": "string" } Also, stopApplication.sync waits for the application to reach the STOPPED state. The EMR Serverless API response doesn't contain any data, but the EMR Serverless service integrati on API response includes the following data.
|
step-functions-dg-205
|
step-functions-dg.pdf
| 205 |
and releases initial capacity if configured. All scheduled and running jobs must be completed or cancelled before stopping an applicati on. deleteApplication DeleteApplication Deletes an application. An application must be in the STOPPED or CREATED state in order to be deleted. The EMR Serverless API response doesn't contain any data, but the EMR Serverless service integrati on API response includes the following data. { "ApplicationId": "string" } Also, stopApplication.sync waits for the application to reach the STOPPED state. The EMR Serverless API response doesn't contain any data, but the EMR Serverless service integrati on API response includes the following data. { "ApplicationId": "string" } Service integration APIs 742 AWS Step Functions Developer Guide EMR Serverless service integration API Corresponding EMR Serverless API Differences deleteApplication.sync DeleteApplication Deletes an application. An application must be in the STOPPED or CREATED state in order to be deleted. The EMR Serverless API response doesn't contain any data, but the EMR Serverless service integrati on API response includes the following data. { "ApplicationId": "string" } Also, stopApplication.sync waits for the application to reach the TERMINATED state. startJobRun StartJobRun None Starts a job run. startJobRun.sync StartJobRun Starts a job run. No differences between the requests and responses of the EMR Serverless API and EMR Serverless service integrati on API. However, startJobR un.sync waits for the applicati on to reach the SUCCESS state. cancelJobRun CancelJobRun None Cancels a job run. Service integration APIs 743 AWS Step Functions Developer Guide EMR Serverless service integration API Corresponding EMR Serverless API Differences cancelJobRun.sync CancelJobRun Cancels a job run. No differences between the requests and responses of the EMR Serverless API and EMR Serverless service integration API. However, cancelJobRun.sync waits for the application to reach the CANCELLED state. EMR Serverless integration use cases For the Optimized EMR Serverless service integration, we recommend that you create a single application, and then use that application to run multiple jobs. For example, in a single state machine, you can include multiple startJobRun requests, all of which use the same application. The following Task workflow state state examples show use cases to integrate EMR Serverless APIs with Step Functions. For information about other use cases of EMR Serverless, see What is Amazon EMR Serverless. Tip To deploy an example of a state machine that integrates with EMR Serverless for running multiple jobs;, see Run an EMR Serverless job. • Create an application • Start an application • Stop an application • Delete an application • Start a job in an application • Cancel a job in an application Integration use cases 744 AWS Step Functions Developer Guide To learn about configuring IAM permissions when using Step Functions with other AWS services, see How Step Functions generates IAM policies for integrated services. In the examples shown in the following use cases, replace the italicized text with your resource-specific information. For example, replace yourApplicationId with the ID of your EMR Serverless application, such as 00yv7iv71inak893. Create an application The following Task state example creates an application using the createApplication.sync service integration API. "Create_Application": { "Type": "Task", "Resource": "arn:aws:states:::emr-serverless:createApplication.sync", "Arguments": { "Name": "MyApplication", "ReleaseLabel": "emr-6.9.0", "Type": "SPARK" }, "End": true } Start an application The following Task state example starts an application using the startApplication.sync service integration API. "Start_Application": { "Type": "Task", "Resource": "arn:aws:states:::emr-serverless:startApplication.sync", "Arguments": { "ApplicationId": "yourApplicationId" }, "End": true } Stop an application The following Task state example stops an application using the stopApplication.sync service integration API. Integration use cases 745 AWS Step Functions Developer Guide "Stop_Application": { "Type": "Task", "Resource": "arn:aws:states:::emr-serverless:stopApplication.sync", "Arguments": { "ApplicationId": "yourApplicationId" }, "End": true } Delete an application The following Task state example deletes an application using the deleteApplication.sync service integration API. "Delete_Application": { "Type": "Task", "Resource": "arn:aws:states:::emr-serverless:deleteApplication.sync", "Arguments": { "ApplicationId": "yourApplicationId" }, "End": true } Start a job in an application The following Task state example starts a job in an application using the startJobRun.sync service integration API. "Start_Job": { "Type": "Task", "Resource": "arn:aws:states:::emr-serverless:startJobRun.sync", "Arguments": { "ApplicationId": "yourApplicationId", "ExecutionRoleArn": "arn:aws:iam::account-id:role/myEMRServerless-execution- role", "JobDriver": { "SparkSubmit": { "EntryPoint": "s3://<amzn-s3-demo-bucket>/sample.py", "EntryPointArguments": ["1"], "SparkSubmitParameters": "--conf spark.executor.cores=4 --conf spark.executor.memory=4g --conf spark.driver.cores=2 --conf spark.driver.memory=4g -- conf spark.executor.instances=1" Integration use cases 746 AWS Step Functions } } }, "End": true } Developer Guide Cancel a job in an application The following Task state example cancels a job in an application using the cancelJobRun.sync service integration API. "Cancel_Job": { "Type": "Task", "Resource": "arn:aws:states:::emr-serverless:cancelJobRun.sync", "Arguments": { "ApplicationId": "{% $states.input.ApplicationId %}", "JobRunId": "{% $states.input.JobRunId %}" }, "End": true } IAM policies for calling Amazon EMR Serverless When you create a state machine using the console, Step Functions automatically creates an execution role for your state machine with the least privileges required. These automatically generated IAM roles are valid for the AWS Region in which you create the state machine. The following example templates show how AWS Step Functions generates IAM policies
|
step-functions-dg-206
|
step-functions-dg.pdf
| 206 |
application The following Task state example cancels a job in an application using the cancelJobRun.sync service integration API. "Cancel_Job": { "Type": "Task", "Resource": "arn:aws:states:::emr-serverless:cancelJobRun.sync", "Arguments": { "ApplicationId": "{% $states.input.ApplicationId %}", "JobRunId": "{% $states.input.JobRunId %}" }, "End": true } IAM policies for calling Amazon EMR Serverless When you create a state machine using the console, Step Functions automatically creates an execution role for your state machine with the least privileges required. These automatically generated IAM roles are valid for the AWS Region in which you create the state machine. The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. We recommend that when you create IAM policies, do not include wildcards in the policies. As a security best practice, you should scope your policies down as much as possible. You should use dynamic policies only when certain input parameters are not known during runtime. Further, administrator users should be careful when granting non-administrator users execution roles for running the state machines. We recommend that you include passRole policies in the execution roles if you're creating policies on your own. We also recommend that you add the aws:SourceARN and aws:SourceAccount context keys in the execution roles. IAM policies 747 AWS Step Functions Developer Guide IAM policy examples for EMR Serverless integration with Step Functions • IAM policy example for CreateApplication • IAM policy example for StartApplication • IAM policy example for StopApplication • IAM policy example for DeleteApplication • IAM policy example for StartJobRun • IAM policy example for CancelJobRun IAM policy example for CreateApplication The following is an IAM policy example for a state machine with a CreateApplication Task workflow state state. Note You need to specify the CreateServiceLinkedRole permissions in your IAM policies during the creation of the first ever application in your account. Thereafter, you need not add this permission. For information about CreateServiceLinkedRole, see CreateServiceLinkedRole in the https://docs.aws.amazon.com/IAM/latest/APIReference/. Static and dynamic resources for the following policies are the same. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:CreateApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/*" ] }, { IAM policies 748 AWS Step Functions Developer Guide "Effect": "Allow", "Action": [ "emr-serverless:GetApplication", "emr-serverless:DeleteApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForEMRServerlessApplicationRule" ] }, { "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "arn:aws:iam::account-id:role/aws-service-role/ops.emr- serverless.amazonaws.com/AWSServiceRoleForAmazonEMRServerless*", "Condition": { "StringLike": { "iam:AWSServiceName": "ops.emr-serverless.amazonaws.com" } } } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", IAM policies 749 AWS Step Functions Developer Guide "Action": [ "emr-serverless:CreateApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/*" ] }, { "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "arn:aws:iam::account-id:role/aws-service-role/ops.emr- serverless.amazonaws.com/AWSServiceRoleForAmazonEMRServerless*", "Condition": { "StringLike": { "iam:AWSServiceName": "ops.emr-serverless.amazonaws.com" } } } ] } IAM policy example for StartApplication Static resources The following are IAM policy examples for static resources when you use a state machine with a StartApplication Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StartApplication", "emr-serverless:GetApplication", "emr-serverless:StopApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" IAM policies 750 Developer Guide AWS Step Functions ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessApplicationRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StartApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" ] } ] } Dynamic resources The following are IAM policy examples for dynamic resources when you use a state machine with a StartApplication Task workflow state state. IAM policies 751 AWS Step Functions Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ Developer Guide "emr-serverless:StartApplication", "emr-serverless:GetApplication", "emr-serverless:StopApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessApplicationRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StartApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" IAM policies 752 AWS Step Functions ] } ] } IAM policy example for StopApplication Static resources Developer Guide The following are IAM policy examples for static resources when you use a state machine with a StopApplication Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StopApplication", "emr-serverless:GetApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessApplicationRule" ] } ] } IAM policies 753 Developer Guide AWS Step Functions Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StopApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" ] } ] } Dynamic resources The following are IAM policy examples for dynamic resources when you use a state machine with a StopApplication Task workflow state state. Run
|
step-functions-dg-207
|
step-functions-dg.pdf
| 207 |
StopApplication Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StopApplication", "emr-serverless:GetApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessApplicationRule" ] } ] } IAM policies 753 Developer Guide AWS Step Functions Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StopApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" ] } ] } Dynamic resources The following are IAM policy examples for dynamic resources when you use a state machine with a StopApplication Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StopApplication", "emr-serverless:GetApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", IAM policies 754 AWS Step Functions Developer Guide "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessApplicationRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StopApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] } ] } IAM policy example for DeleteApplication Static resources The following are IAM policy examples for static resources when you use a state machine with a DeleteApplication Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", IAM policies 755 AWS Step Functions "Action": [ "emr-serverless:DeleteApplication", "emr-serverless:GetApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ Developer Guide [[applicationId]]" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessApplicationRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:DeleteApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" ] } ] } IAM policies 756 AWS Step Functions Dynamic resources Developer Guide The following are IAM policy examples for dynamic resources when you use a state machine with a DeleteApplication Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:DeleteApplication", "emr-serverless:GetApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessApplicationRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ IAM policies 757 AWS Step Functions Developer Guide "emr-serverless:DeleteApplication" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] } ] } IAM policy example for StartJobRun Static resources The following are IAM policy examples for static resources when you use a state machine with a StartJobRun Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StartJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" ] }, { "Effect": "Allow", "Action": "iam:PassRole", "Resource": [ "[[jobExecutionRoleArn]]" ], "Condition": { "StringEquals": { "iam:PassedToService": "emr-serverless.amazonaws.com" } } }, IAM policies 758 AWS Step Functions { "Effect": "Allow", "Action": [ "emr-serverless:GetJobRun", "emr-serverless:CancelJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ Developer Guide [[applicationId]]/jobruns/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessJobRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StartJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]" ] }, { "Effect": "Allow", IAM policies 759 AWS Step Functions Developer Guide "Action": "iam:PassRole", "Resource": [ "[[jobExecutionRoleArn]]" ], "Condition": { "StringEquals": { "iam:PassedToService": "emr-serverless.amazonaws.com" } } } ] } Dynamic resources The following are IAM policy examples for dynamic resources when you use a state machine with a StartJobRun Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StartJobRun", "emr-serverless:GetJobRun", "emr-serverless:CancelJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] }, { "Effect": "Allow", "Action": "iam:PassRole", "Resource": [ "[[jobExecutionRoleArn]]" ], "Condition": { "StringEquals": { IAM policies 760 AWS Step Functions Developer Guide "iam:PassedToService": "emr-serverless.amazonaws.com" } } }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessJobRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:StartJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] }, { "Effect": "Allow", "Action": "iam:PassRole", "Resource": [ "[[jobExecutionRoleArn]]" ], "Condition": { "StringEquals": { "iam:PassedToService": "emr-serverless.amazonaws.com" } IAM policies 761 AWS Step Functions } } ] } IAM policy example for CancelJobRun Static resources Developer Guide The following are IAM policy examples for static resources when you use a state machine with a CancelJobRun Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:CancelJobRun", "emr-serverless:GetJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]/jobruns/[[jobRunId]]" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessJobRule" ] } ] } IAM policies 762 Developer Guide AWS Step Functions Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:CancelJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]/jobruns/[[jobRunId]]" ] } ] } Dynamic resources The following are IAM policy examples for dynamic resources when you use a state machine with a CancelJobRun Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:CancelJobRun", "emr-serverless:GetJobRun" ], "Resource":
|
step-functions-dg-208
|
step-functions-dg.pdf
| 208 |
"Action": [ "emr-serverless:CancelJobRun", "emr-serverless:GetJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]/jobruns/[[jobRunId]]" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessJobRule" ] } ] } IAM policies 762 Developer Guide AWS Step Functions Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:CancelJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/ [[applicationId]]/jobruns/[[jobRunId]]" ] } ] } Dynamic resources The following are IAM policy examples for dynamic resources when you use a state machine with a CancelJobRun Task workflow state state. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:CancelJobRun", "emr-serverless:GetJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", IAM policies 763 AWS Step Functions Developer Guide "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account- id:rule/StepFunctionsGetEventsForEMRServerlessJobRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "emr-serverless:CancelJobRun" ], "Resource": [ "arn:aws:emr-serverless:region:account-id:/applications/*" ] } ] } Add EventBridge events with Step Functions Step Functions provides a service integration API for integrating with Amazon EventBridge. Learn how to build event-driven applications by sending custom events directly from Step Functions workflows. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Amazon EventBridge 764 AWS Step Functions Developer Guide Key features of Optimized EventBridge integration • The execution ARN and the state machine ARN are automatically appended to the Resources field of each PutEventsRequestEntry. • If the response from PutEvents contains a non-zero FailedEntryCount then the Task state fails with the error EventBridge.FailedEntry. To use the PutEvents API, you will need to create an EventBridge rule in your account that matches the specific pattern of the events you will send. For example, you could: • Create a Lambda function in your account that receives and prints an event that matches an EventBridge rule. • Create an EventBridge rule in your account on the default event bus that matches a specific event pattern and targets the Lambda function. For more information, see: • Adding Amazon EventBridge events with PutEvents in the EventBridge User Guide. • Wait for a Callback with Task Token in Service Integration Patterns. The following includes a Task that sends a custom event: { "Type": "Task", "Resource": "arn:aws:states:::events:putEvents", "Arguments": { "Entries": [ { "Detail": { "Message": "MyMessage" }, "DetailType": "MyDetailType", "EventBusName": "MyEventBus", "Source": "my.source" } ] }, Amazon EventBridge 765 AWS Step Functions "End": true } Developer Guide Quota for input or result data When sending or receiving data between services, the maximum input or result for a task is 256 KiB of data as a UTF-8 encoded string. See Quotas related to state machine executions. Optimized EventBridge API Supported EventBridge API and syntax include: • PutEvents • Request syntax • Supported parameter: • Entries • Response syntax Error handling The PutEvents API accepts an array of entries as input, then returns an array of result entries. As long as the PutEvents action was successful, PutEvents will return an HTTP 200 response, even if one or more entries failed. PutEvents returns the number of failed entries in the FailedEntryCount field. Step Functions checks whether the FailedEntryCount is greater than zero. If it is greater than zero, Step Functions fails the state with the error EventBridge.FailedEntry. This lets you use the built-in error handling of Step Functions on task states to catch or retry when there are failed entries, rather than needing to use an additional state to analyze the FailedEntryCount from the response. Note If you have implemented idempotency and can safely retry on all entries, you can use Step Functions' retry logic. Step Functions does not remove successful entries from the PutEvents input array before retrying. Instead, it retries with the original array of entries. Supported APIs 766 AWS Step Functions Developer Guide IAM policies for calling EventBridge The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. PutEvents Static resources { "Version": "2012-10-17", "Statement": [ { "Action": [ "events:PutEvents" ], "Resource": [ "arn:aws:events:region:account-id:event-bus/my-project-eventbus" ], "Effect": "Allow" } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "events:PutEvents" ], "Resource": "arn:aws:events:*:*:event-bus/*" } ] } IAM policies 767 AWS Step Functions Developer Guide Start an AWS Glue job with Step Functions Learn to use Step Functions to start a job run on AWS Glue. This page lists the supported API actions and provides an example Task state to start a AWS Glue job. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized AWS Glue integration • The Run
|
step-functions-dg-209
|
step-functions-dg.pdf
| 209 |
Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "events:PutEvents" ], "Resource": "arn:aws:events:*:*:event-bus/*" } ] } IAM policies 767 AWS Step Functions Developer Guide Start an AWS Glue job with Step Functions Learn to use Step Functions to start a job run on AWS Glue. This page lists the supported API actions and provides an example Task state to start a AWS Glue job. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized AWS Glue integration • The Run a Job (.sync) integration pattern is available. • The JobName field is extracted from the request and inserted into the response, which normally only contains JobRunID. The following includes a Task state that starts an AWS Glue job. "Glue StartJobRun": { "Type": "Task", "Resource": "arn:aws:states:::glue:startJobRun.sync", "Arguments": { "JobName": "GlueJob-JTrRO5l98qMG" }, "Next": "ValidateOutput" }, Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. Optimized AWS Glue APIs • StartJobRun AWS Glue 768 AWS Step Functions Developer Guide IAM policies for calling AWS Glue The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. AWS Glue does not have resource-based control. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:StartJobRun", "glue:GetJobRun", "glue:GetJobRuns", "glue:BatchStopJobRun" ], "Resource": "*" } ] } Request Response and Callback (.waitForTaskToken) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "glue:StartJobRun" ], "Resource": "*" } ] } IAM policies 769 AWS Step Functions Developer Guide Start AWS Glue DataBrew jobs with Step Functions Learn how you can use the DataBrew integration to add data cleaning and data normalization steps into your analytics and machine learning workflows with Step Functions. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. The following includes a Task state that starts a request-response DataBrew job. "DataBrew StartJobRun": { "Type": "Task", "Resource": "arn:aws:states:::databrew:startJobRun", "Arguments": { "Name": "sample-proj-job-1" }, "Next": "NEXT_STATE" }, The following includes a Task state that starts a sync DataBrew job. "DataBrew StartJobRun": { "Type": "Task", "Resource": "arn:aws:states:::databrew:startJobRun.sync", "Arguments": { "Name": "sample-proj-job-1" }, "Next": "NEXT_STATE" }, Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. AWS Glue DataBrew 770 AWS Step Functions Developer Guide Supported DataBrew APIs • StartJobRun IAM policies for calling DataBrew The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "databrew:startJobRun", "databrew:listJobRuns", "databrew:stopJobRun" ], "Resource": [ "arn:aws:databrew:region:account-id:job/*" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "databrew:startJobRun" ], "Resource": [ Supported APIs 771 AWS Step Functions Developer Guide "arn:aws:databrew:region:account-id:job/*" ] } ] } Invoke an AWS Lambda function with Step Functions Learn how to use Step Functions to invoke Lambda functions either synchronously or asynchronously as part of an event-driven serverless application. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized Lambda integration • The Payload field of the response is parsed from escaped Json to Json. • If the response contains the field FunctionError or an exception is raised within the Lambda function, the task fails. For more information about managing state input, output, and results, see Processing input and output in Step Functions. Optimized Lambda APIs • Invoke • Request Syntax • Supported Parameters • ClientContext • FunctionName • InvocationType • Qualifier • Payload • Response syntax AWS Lambda 772 AWS Step Functions Workflow Examples Developer Guide The following includes a Task state that invokes a Lambda function. { "StartAt":"CallLambda", "States":{ "CallLambda":{ "Type":"Task", "Resource":"arn:aws:states:::lambda:invoke", "Arguments":{ "FunctionName":"arn:aws:lambda:region:account-id:function:MyFunction" }, "End":true } } } The following includes a Task state that implements the callback service integration pattern. { "StartAt":"GetManualReview", "States":{ "GetManualReview":{ "Type":"Task", "Resource":"arn:aws:states:::lambda:invoke.waitForTaskToken", "Arguments":{ "FunctionName":"arn:aws:lambda:region:account-id:function:get-model-review- decision", "Payload":{ "model":"{% $states.input.my-model %}", "TaskToken": "{% $states.context.Task.Token %}" }, "Qualifier":"prod-v1" }, "End":true } } } When you invoke a Lambda function, the execution will wait for the function to complete. If you invoke the Lambda function with a callback task, the heartbeat timeout does not start
|
step-functions-dg-210
|
step-functions-dg.pdf
| 210 |
772 AWS Step Functions Workflow Examples Developer Guide The following includes a Task state that invokes a Lambda function. { "StartAt":"CallLambda", "States":{ "CallLambda":{ "Type":"Task", "Resource":"arn:aws:states:::lambda:invoke", "Arguments":{ "FunctionName":"arn:aws:lambda:region:account-id:function:MyFunction" }, "End":true } } } The following includes a Task state that implements the callback service integration pattern. { "StartAt":"GetManualReview", "States":{ "GetManualReview":{ "Type":"Task", "Resource":"arn:aws:states:::lambda:invoke.waitForTaskToken", "Arguments":{ "FunctionName":"arn:aws:lambda:region:account-id:function:get-model-review- decision", "Payload":{ "model":"{% $states.input.my-model %}", "TaskToken": "{% $states.context.Task.Token %}" }, "Qualifier":"prod-v1" }, "End":true } } } When you invoke a Lambda function, the execution will wait for the function to complete. If you invoke the Lambda function with a callback task, the heartbeat timeout does not start counting Examples 773 AWS Step Functions Developer Guide until after the Lambda function has completed executing and returned a result. As long as the Lambda function executes, the heartbeat timeout is not enforced. It is also possible to call Lambda asynchronously using the InvocationType parameter, as seen in the following example: Note For asynchronous invocations of Lambda functions, the heartbeat timeout period starts immediately. { "Comment": "A Hello World example of the Amazon States Language using Pass states", "StartAt": "Hello", "States": { "Hello": { "Type": "Task", "Resource": "arn:aws:states:::lambda:invoke", "Arguments": { "FunctionName": "arn:aws:lambda:region:account-id:function:echo", "InvocationType": "Event" }, "End": true } } } When the Task result is returned, the function output is nested inside a dictionary of metadata. For example: { "ExecutedVersion":"$LATEST", "Payload":"FUNCTION OUTPUT", "SdkHttpMetadata":{ "HttpHeaders":{ "Connection":"keep-alive", "Content-Length":"4", "Content-Type":"application/json", Examples 774 AWS Step Functions Developer Guide "Date":"Fri, 26 Mar 2021 07:42:02 GMT", "X-Amz-Executed-Version":"$LATEST", "x-amzn-Remapped-Content-Length":"0", "x-amzn-RequestId":"0101aa0101-1111-111a-aa55-1010aaa1010", "X-Amzn-Trace-Id":"root=1-1a1a000a2a2-fe0101aa10ab;sampled=0" }, "HttpStatusCode":200 }, "SdkResponseMetadata":{ "RequestId":"6b3bebdb-9251-453a-ae45-512d9e2bf4d3" }, "StatusCode":200 } Alternatively, you can invoke a Lambda function by specifying a function ARN directly in the "Resource" field. When you invoke a Lambda function in this way, you can't specify .waitForTaskToken, and the task result contains only the function output. { "StartAt":"CallFunction", "States":{ "CallFunction": { "Type":"Task", "Resource":"arn:aws:lambda:region:account-id:function:HelloFunction", "End": true } } } You can invoke a specific Lambda function version or alias by specifying those options in the ARN in the Resource field. See the following in the Lambda documentation: • AWS Lambda versioning • AWS Lambda aliases IAM policies for calling AWS Lambda The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions IAM policies 775 AWS Step Functions Developer Guide generates IAM policies for integrated services and Discover service integration patterns in Step Functions. In the following example, a state machine with two AWS Lambda task states which call function1 and function2, the autogenerated policy includes lambda:Invoke permission for both functions. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "lambda:InvokeFunction" ], "Resource": [ "arn:aws:lambda:region:account-id:function:function-1", "arn:aws:lambda:region:account-id:function:function-2" ] } ] } Create an AWS Elemental MediaConvert job with Step Functions Learn how to use Step Functions to create an AWS Elemental MediaConvert job using the CreateJob API. Experiment with Step Functions and MediaConvert Learn how to use the MediaConvert optimized integration in a workflow that detects and removes SMTPE color bars of unknown length from the beginning of a video clip. Read the blog post from Apr, 12, 2024: Low code workflows with AWS Elemental MediaConvert To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. AWS Elemental MediaConvert 776 AWS Step Functions Developer Guide Key features of Optimized MediaConvert integration • The Run a Job (.sync) and Request Response integration patterns are supported. • Step Functions will add the following custom tag to MediaConvert jobs: ManagedByService: AWSStepFunctions • There is no specific optimization for Wait for a Callback with Task Token integration patterns. The following includes a Task state that submits a MediaConvert job and waits for it to complete. { "StartAt": "MediaConvert_CreateJob", "States": { "MediaConvert_CreateJob": { "Type": "Task", "Resource": "arn:aws:states:::mediaconvert:createJob.sync", "Arguments": { "Role": "arn:aws:iam::111122223333:role/Admin", "Settings": { "OutputGroups": [ { "Outputs": [ { "ContainerSettings": { "Container": "MP4" }, "VideoDescription": { "CodecSettings": { "Codec": "H_264", "H264Settings": { "MaxBitrate": 1000, "RateControlMode": "QVBR", "SceneChangeDetect": "TRANSITION_DETECTION" } } }, "AudioDescriptions": [ { "CodecSettings": { "Codec": "AAC", AWS Elemental MediaConvert 777 AWS Step Functions Developer Guide "AacSettings": { "Bitrate": 96000, "CodingMode": "CODING_MODE_2_0", "SampleRate": 48000 } } } ] } ], "OutputGroupSettings": { "Type": "FILE_GROUP_SETTINGS", "FileGroupSettings": { "Destination": "s3://amzn-s3-demo-destination-bucket/" } } } ], "Inputs": [ { "AudioSelectors": { "Audio Selector 1": { "DefaultSelection": "DEFAULT" } }, "FileInput": "s3://amzn-s3-demo-bucket/DOC-EXAMPLE-SOURCE_FILE" } ] } }, "End": true } } } Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. AWS Elemental MediaConvert 778 AWS Step Functions Developer Guide Optimized MediaConvert APIs • CreateJob • Request syntax • Supported parameters: • Role (Required) • Settings (Required) • CreateJobRequest (Optional) • Response syntax – see CreateJobResponse schema IAM policies for calling AWS Elemental MediaConvert
|
step-functions-dg-211
|
step-functions-dg.pdf
| 211 |
} ], "Inputs": [ { "AudioSelectors": { "Audio Selector 1": { "DefaultSelection": "DEFAULT" } }, "FileInput": "s3://amzn-s3-demo-bucket/DOC-EXAMPLE-SOURCE_FILE" } ] } }, "End": true } } } Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. AWS Elemental MediaConvert 778 AWS Step Functions Developer Guide Optimized MediaConvert APIs • CreateJob • Request syntax • Supported parameters: • Role (Required) • Settings (Required) • CreateJobRequest (Optional) • Response syntax – see CreateJobResponse schema IAM policies for calling AWS Elemental MediaConvert The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. The IAM policy for GetJob and CancelJob actions are scoped to only permit access to jobs with the ManagedByService: AWSStepFunctions tag. Tag-based policy Modifying the autogenerated ManagedByService: AWSStepFunctions tag will cause state machine executions to fail. Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Sid": "MediaConvertCreateJob", "Effect": "Allow", "Action": [ "mediaconvert:CreateJob" ], "Resource": [ Supported APIs 779 AWS Step Functions Developer Guide "arn:aws:mediaconvert:region:account-id:queues/*", "arn:aws:mediaconvert:region:account-id:jobTemplates/*", "arn:aws:mediaconvert:region:account-id:presets/*" ] }, { "Sid": "MediaConvertManageJob", "Effect": "Allow", "Action": [ "mediaconvert:GetJob", "mediaconvert:CancelJob" ], "Resource": "arn:aws:mediaconvert:region:account-id:jobs/*", "Condition": { "StringEquals": { "aws:ResourceTag/ManagedByService": "AWSStepFunctions" } } }, { "Sid": "IamPassRole", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/roleName" ], "Condition": { "StringEquals": { "iam:PassedToService": [ "mediaconvert.amazonaws.com" ] } } }, { "Sid": "EventBridgeManageRule", "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], IAM policies 780 AWS Step Functions Developer Guide "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForMediaConvertJobRule" ] } ] } Request Response { "Version": "2012-10-17", "Statement": [ { "Sid": "MediaConvertCreateJob", "Effect": "Allow", "Action": [ "mediaconvert:CreateJob" ], "Resource": [ "arn:aws:mediaconvert:region:account-id:queues/*", "arn:aws:mediaconvert:region:account-id:jobTemplates/*", "arn:aws:mediaconvert:region:account-id:presets/*" ] }, { "Sid": "IamPassRole", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::account-id:role/roleName" ], "Condition": { "StringEquals": { "iam:PassedToService": [ "mediaconvert.amazonaws.com" ] } } } ] IAM policies 781 AWS Step Functions } Developer Guide Create and manage Amazon SageMaker AI jobs with Step Functions Learn how to use Step Functions to create and manage jobs on SageMaker AI. This page lists the supported SageMaker AI API actions and provides example Task states to create SageMaker AI transform, training, labeling, and processing jobs. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized SageMaker AI integration • The Run a Job (.sync) integration pattern is supported. • There are no specific optimizations for the Request Response integration pattern. • The Wait for a Callback with Task Token integration pattern is not supported. Optimized SageMaker AI APIs • CreateEndpoint • Request syntax • Supported parameters: • EndpointConfigName • EndpointName • Tags • Response syntax • CreateEndpointConfig • Request syntax • Supported parameters: • EndpointConfigName • KmsKeyId Amazon SageMaker AI 782 Developer Guide AWS Step Functions • ProductionVariants • Tags • Response syntax • CreateHyperParameterTuningJob - Supports the .sync integration pattern. • Request syntax • Supported parameters: • HyperParameterTuningJobConfig • HyperParameterTuningJobName • Tags • TrainingJobDefinition • WarmStartConfig • Response syntax • CreateLabelingJob - Supports the .sync integration pattern. • Request syntax • Supported parameters: • HumanTaskConfig • InputConfig • LabelAttributeName • LabelCategoryConfigS3Uri • LabelingJobAlgorithmsConfig • LabelingJobName • OutputConfig • RoleArn • StoppingConditions • Tags • Response syntax • CreateModel • Request syntax • Supported parameters: Supported APIs • Containers 783 AWS Step Functions Developer Guide • EnableNetworkIsolation • ExecutionRoleArn • ModelName • PrimaryContainer • Tags • VpcConfig • CreateProcessingJob - Supports the .sync integration pattern. • Request syntax • Supported parameters: • AppSpecification • Environment • ExperimentConfig • NetworkConfig • ProcessingInputs • ProcessingJobName • ProcessingOutputConfig • ProcessingResources • RoleArn • StoppingCondition • Tags • Response syntax • CreateTrainingJob - Supports the .sync integration pattern. • Request syntax • Supported parameters: • AlgorithmSpecification • HyperParameters • InputDataConfig • OutputDataConfig • ResourceConfig Supported APIs • RoleArn 784 AWS Step Functions Developer Guide • StoppingCondition • Tags • TrainingJobName • VpcConfig • Response syntax • CreateTransformJob - Supports the .sync integration pattern. Note AWS Step Functions will not automatically create a policy for CreateTransformJob. You must attach an inline policy to the created role. For more information, see this example IAM policy: CreateTrainingJob. • Request syntax • Supported parameters: • BatchStrategy • Environment • MaxConcurrentTransforms • MaxPayloadInMB • ModelName • Tags • TransformInput • TransformJobName • TransformOutput • TransformResources • Response syntax • UpdateEndpoint • Request syntax • Supported parameters: • EndpointConfigName Supported APIs • EndpointName 785 AWS Step Functions • Response syntax Developer Guide SageMaker AI Transform Job Example The following includes a Task state that creates an Amazon SageMaker AI transform job, specifying the Amazon S3 location for DataSource and TransformOutput.
|
step-functions-dg-212
|
step-functions-dg.pdf
| 212 |
CreateTransformJob. You must attach an inline policy to the created role. For more information, see this example IAM policy: CreateTrainingJob. • Request syntax • Supported parameters: • BatchStrategy • Environment • MaxConcurrentTransforms • MaxPayloadInMB • ModelName • Tags • TransformInput • TransformJobName • TransformOutput • TransformResources • Response syntax • UpdateEndpoint • Request syntax • Supported parameters: • EndpointConfigName Supported APIs • EndpointName 785 AWS Step Functions • Response syntax Developer Guide SageMaker AI Transform Job Example The following includes a Task state that creates an Amazon SageMaker AI transform job, specifying the Amazon S3 location for DataSource and TransformOutput. { "SageMaker CreateTransformJob": { "Type": "Task", "Resource": "arn:aws:states:::sagemaker:createTransformJob.sync", "Arguments": { "ModelName": "SageMakerCreateTransformJobModel-9iFBKsYti9vr", "TransformInput": { "CompressionType": "None", "ContentType": "text/csv", "DataSource": { "S3DataSource": { "S3DataType": "S3Prefix", "S3Uri": "s3://amzn-s3-demo-source-bucket1/TransformJobDataInput.txt" } } }, "TransformOutput": { "S3OutputPath": "s3://amzn-s3-demo-source-bucket1/TransformJobOutputPath" }, "TransformResources": { "InstanceCount": 1, "InstanceType": "ml.m4.xlarge" }, "TransformJobName": "sfn-binary-classification-prediction" }, "Next": "ValidateOutput" }, SageMaker AI Training Job Example The following includes a Task state that creates an Amazon SageMaker AI training job. { "SageMaker CreateTrainingJob":{ Transform Job Example 786 AWS Step Functions "Type":"Task", "Resource":"arn:aws:states:::sagemaker:createTrainingJob.sync", "Arguments":{ Developer Guide "TrainingJobName":"search-model", "ResourceConfig":{ "InstanceCount":4, "InstanceType":"ml.c4.8xlarge", "VolumeSizeInGB":20 }, "HyperParameters":{ "mode":"batch_skipgram", "epochs":"5", "min_count":"5", "sampling_threshold":"0.0001", "learning_rate":"0.025", "window_size":"5", "vector_dim":"300", "negative_samples":"5", "batch_size":"11" }, "AlgorithmSpecification":{ "TrainingImage":"...", "TrainingInputMode":"File" }, "OutputDataConfig":{ "S3OutputPath":"s3://amzn-s3-demo-destination-bucket1/doc-search/model" }, "StoppingCondition":{ "MaxRuntimeInSeconds":100000 }, "RoleArn":"arn:aws:iam::account-id:role/docsearch-stepfunction-iam-role", "InputDataConfig":[ { "ChannelName":"train", "DataSource":{ "S3DataSource":{ "S3DataType":"S3Prefix", "S3Uri":"s3://amzn-s3-demo-destination-bucket1/doc-search/interim- data/training-data/", "S3DataDistributionType":"FullyReplicated" } } } ] Training Job Example 787 Developer Guide AWS Step Functions }, "Retry":[ { "ErrorEquals":[ "SageMaker.AmazonSageMakerException" ], "IntervalSeconds":1, "MaxAttempts":100, "BackoffRate":1.1 }, { "ErrorEquals":[ "SageMaker.ResourceLimitExceededException" ], "IntervalSeconds":60, "MaxAttempts":5000, "BackoffRate":1 }, { "ErrorEquals":[ "States.Timeout" ], "IntervalSeconds":1, "MaxAttempts":5, "BackoffRate":1 } ], "Catch":[ { "ErrorEquals":[ "States.ALL" ], "Next":"Sagemaker Training Job Error" } ], "Next":"Delete Interim Data Job" } } Training Job Example 788 AWS Step Functions Developer Guide SageMaker AI Labeling Job Example The following includes a Task state that creates an Amazon SageMaker AI labeling job. { "StartAt": "SageMaker CreateLabelingJob", "TimeoutSeconds": 3600, "States": { "SageMaker CreateLabelingJob": { "Type": "Task", "Resource": "arn:aws:states:::sagemaker:createLabelingJob.sync", "Arguments": { "HumanTaskConfig": { "AnnotationConsolidationConfig": { "AnnotationConsolidationLambdaArn": "arn:aws:lambda:region:123456789012:function:ACS-TextMultiClass" }, "NumberOfHumanWorkersPerDataObject": 1, "PreHumanTaskLambdaArn": "arn:aws:lambda:region:123456789012:function:PRE- TextMultiClass", "TaskDescription": "Classify the following text", "TaskKeywords": [ "tc", "Labeling" ], "TaskTimeLimitInSeconds": 300, "TaskTitle": "Classify short bits of text", "UiConfig": { "UiTemplateS3Uri": "s3://amzn-s3-demo-bucket/TextClassification.template" }, "WorkteamArn": "arn:aws:sagemaker:region:123456789012:workteam/private-crowd/ ExampleTesting" }, "InputConfig": { "DataAttributes": { "ContentClassifiers": [ "FreeOfPersonallyIdentifiableInformation", "FreeOfAdultContent" ] }, "DataSource": { "S3DataSource": { "ManifestS3Uri": "s3://amzn-s3-demo-bucket/manifest.json" Labeling Job Example 789 AWS Step Functions } } }, Developer Guide "LabelAttributeName": "Categories", "LabelCategoryConfigS3Uri": "s3://amzn-s3-demo-bucket/labelcategories.json", "LabelingJobName": "example-job-name", "OutputConfig": { "S3OutputPath": "s3://amzn-s3-demo-bucket/output" }, "RoleArn": "arn:aws:iam::123456789012:role/service-role/AmazonSageMaker- ExecutionRole", "StoppingConditions": { "MaxHumanLabeledObjectCount": 10000, "MaxPercentageOfInputDatasetLabeled": 100 } }, "Next": "ValidateOutput" }, "ValidateOutput": { "Type": "Choice", "Choices": [ { "Next": "Success", "Condition": "{% $states.input.LabelingJobArn != '' %}" } ], "Default": "Fail" }, "Success": { "Type": "Succeed" }, "Fail": { "Type": "Fail", "Error": "InvalidOutput", "Cause": "Output is not what was expected. This could be due to a service outage or a misconfigured service integration." } } } SageMaker AI Processing Job Example The following includes a Task state that creates an Amazon SageMaker AI processing job. Processing Job Example 790 AWS Step Functions Developer Guide { "StartAt": "SageMaker CreateProcessingJob Sync", "TimeoutSeconds": 3600, "States": { "SageMaker CreateProcessingJob Sync": { "Type": "Task", "Resource": "arn:aws:states:::sagemaker:createProcessingJob.sync", "Arguments": { "AppSpecification": { "ImageUri": "737474898029.dkr.ecr.sa-east-1.amazonaws.com/sagemaker-scikit- learn:0.20.0-cpu-py3" }, "ProcessingResources": { "ClusterConfig": { "InstanceCount": 1, "InstanceType": "ml.t3.medium", "VolumeSizeInGB": 10 } }, "RoleArn": "arn:aws:iam::account-id:role/SM-003- CreateProcessingJobAPIExecutionRole", "ProcessingJobName.$": "$.id" }, "Next": "ValidateOutput" }, "ValidateOutput": { "Type": "Choice", "Choices": [ { "Not": { "Variable": "$.ProcessingJobArn", "StringEquals": "" }, "Next": "Succeed" } ], "Default": "Fail" }, "Succeed": { "Type": "Succeed" }, "Fail": { "Type": "Fail", Processing Job Example 791 AWS Step Functions Developer Guide "Error": "InvalidConnectorOutput", "Cause": "Connector output is not what was expected. This could be due to a service outage or a misconfigured connector." } } } IAM policies for calling Amazon SageMaker AI The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Note For these examples, roleArn refers to the Amazon Resource Name (ARN) of the IAM role that SageMaker AI uses to access model artifacts and docker images for deployment on ML compute instances, or for batch transform jobs. For more information, see Amazon SageMaker Roles. CreateTrainingJob Static resources Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTrainingJob", "sagemaker:DescribeTrainingJob", "sagemaker:StopTrainingJob" ], "Resource": [ "arn:aws:sagemaker:region:account-id:training-job/jobName*" ] IAM policies 792 AWS Step Functions }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { "iam:PassedToService": "sagemaker.amazonaws.com" } } }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForSageMakerTrainingJobsRule" ] } ] } Request Response and Callback (.waitForTaskToken) { IAM policies Developer Guide 793 AWS Step Functions Developer Guide "Version": "2012-10-17", "Statement": [ {
|
step-functions-dg-213
|
step-functions-dg.pdf
| 213 |
resources Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTrainingJob", "sagemaker:DescribeTrainingJob", "sagemaker:StopTrainingJob" ], "Resource": [ "arn:aws:sagemaker:region:account-id:training-job/jobName*" ] IAM policies 792 AWS Step Functions }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { "iam:PassedToService": "sagemaker.amazonaws.com" } } }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForSageMakerTrainingJobsRule" ] } ] } Request Response and Callback (.waitForTaskToken) { IAM policies Developer Guide 793 AWS Step Functions Developer Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTrainingJob" ], "Resource": [ "arn:aws:sagemaker:region:account-id:training-job/jobName*" ] }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { "iam:PassedToService": "sagemaker.amazonaws.com" } } } ] } Dynamic resources IAM policies 794 Developer Guide AWS Step Functions .sync or .waitForTaskToken { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTrainingJob", "sagemaker:DescribeTrainingJob", "sagemaker:StopTrainingJob" ], "Resource": [ "arn:aws:sagemaker:region:account-id:training-job/*" ] }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { "iam:PassedToService": "sagemaker.amazonaws.com" } } }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", IAM policies 795 AWS Step Functions Developer Guide "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForSageMakerTrainingJobsRule" ] } ] } Request Response and Callback (.waitForTaskToken) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTrainingJob" ], "Resource": [ "arn:aws:sagemaker:region:account-id:training-job/*" ] }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { IAM policies 796 AWS Step Functions Developer Guide "iam:PassedToService": "sagemaker.amazonaws.com" } } } ] } CreateTransformJob Note AWS Step Functions will not automatically create a policy for CreateTransformJob when you create a state machine that integrates with SageMaker AI. You must attach an inline policy to the created role based on one of the following IAM examples. Static resources Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTransformJob", "sagemaker:DescribeTransformJob", "sagemaker:StopTransformJob" ], "Resource": [ "arn:aws:sagemaker:region:account-id:transform-job/jobName*" ] }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" IAM policies 797 Developer Guide AWS Step Functions ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { "iam:PassedToService": "sagemaker.amazonaws.com" } } }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForSageMakerTransformJobsRule" ] } ] } Request Response and Callback (.waitForTaskToken) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTransformJob" ], "Resource": [ IAM policies 798 AWS Step Functions Developer Guide "arn:aws:sagemaker:region:account-id:transform-job/jobName*" ] }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { "iam:PassedToService": "sagemaker.amazonaws.com" } } } ] } Dynamic resources Run a Job (.sync) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTransformJob", "sagemaker:DescribeTransformJob", IAM policies 799 AWS Step Functions Developer Guide "sagemaker:StopTransformJob" ], "Resource": [ "arn:aws:sagemaker:region:account-id:transform-job/*" ] }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { "iam:PassedToService": "sagemaker.amazonaws.com" } } }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForSageMakerTransformJobsRule" ] } ] } IAM policies 800 AWS Step Functions Developer Guide Request Response and Callback (.waitForTaskToken) { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:CreateTransformJob" ], "Resource": [ "arn:aws:sagemaker:region:account-id:transform-job/*" ] }, { "Effect": "Allow", "Action": [ "sagemaker:ListTags" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "roleArn" ], "Condition": { "StringEquals": { "iam:PassedToService": "sagemaker.amazonaws.com" } } } ] } IAM policies 801 AWS Step Functions Developer Guide Publish messages to an Amazon SNS topic with Step Functions Learn how to use Step Functions to publish messages to an Amazon SNS topic. This page lists the supported Amazon SNS API actions and provides example Task states to publish message to Amazon SNS. To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. Key features of Optimized Amazon SNS integration There are no specific optimizations for the Request Response or Wait for a Callback with Task Token integration patterns. The following includes a Task state that publishes to an Amazon Simple Notification Service (Amazon SNS) topic. { "StartAt": "Publish to SNS", "States": { "Publish to SNS": { "Type": "Task", "Resource": "arn:aws:states:::sns:publish", "Arguments": { "TopicArn": "arn:aws:sns:region:account-id:myTopic", "Message": "{% states.input.message %}", "MessageAttributes": { "my_attribute_no_1": { "DataType": "String", "StringValue": "value of my_attribute_no_1" }, "my_attribute_no_2": { "DataType": "String", "StringValue": "value of my_attribute_no_2" } } }, "End": true } } Amazon
|
step-functions-dg-214
|
step-functions-dg.pdf
| 214 |
to a service API in Step Functions. Key features of Optimized Amazon SNS integration There are no specific optimizations for the Request Response or Wait for a Callback with Task Token integration patterns. The following includes a Task state that publishes to an Amazon Simple Notification Service (Amazon SNS) topic. { "StartAt": "Publish to SNS", "States": { "Publish to SNS": { "Type": "Task", "Resource": "arn:aws:states:::sns:publish", "Arguments": { "TopicArn": "arn:aws:sns:region:account-id:myTopic", "Message": "{% states.input.message %}", "MessageAttributes": { "my_attribute_no_1": { "DataType": "String", "StringValue": "value of my_attribute_no_1" }, "my_attribute_no_2": { "DataType": "String", "StringValue": "value of my_attribute_no_2" } } }, "End": true } } Amazon SNS 802 AWS Step Functions } Developer Guide Passing dynamic values. You can modify the above example to dynamically pass an attribute from this JSON payload: { "message": "Hello world", "SNSDetails": { "attribute1": "some value", "attribute2": "some other value", } } The following sets values using JSONata expressions for the StringValue fields: "MessageAttributes": { "my_attribute_no_1": { "DataType": "String", "StringValue": "{% $states.input.SNSDetails.attribute1 %}" }, "my_attribute_no_2": { "DataType": "String", "StringValue": "{% $states.input.SNSDetails.attribute2 %}" } The following includes a Task state that publishes to an Amazon SNS topic, and then waits for the task token to be returned. See Wait for a Callback with Task Token. { "StartAt":"Send message to SNS", "States":{ "Send message to SNS":{ "Type":"Task", "Resource":"arn:aws:states:::sns:publish.waitForTaskToken", "Arguments":{ "TopicArn":"arn:aws:sns:region:account-id:myTopic", "Message":{ "Input":"{% states.input.message %}", "TaskToken": "{% $states.context.Task.Token %}" } }, "End":true Amazon SNS 803 Developer Guide AWS Step Functions } } } Optimized Amazon SNS APIs • Publish • Request syntax • Supported Parameters • Message • MessageAttributes • MessageStructure • PhoneNumber • Subject • TargetArn • TopicArn • Response syntax Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. Quota for input or result data When sending or receiving data between services, the maximum input or result for a task is 256 KiB of data as a UTF-8 encoded string. See Quotas related to state machine executions. IAM policies for calling Amazon SNS The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions Supported APIs 804 AWS Step Functions Developer Guide generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sns:Publish" ], "Resource": [ "arn:aws:sns:region:account-id:topicName" ] } ] } Resources based on a Path, or publishing to TargetArn or PhoneNumber { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sns:Publish" ], "Resource": "*" } ] } Send messages to an Amazon SQS queue with Step Functions You can to send messages to an Amazon SQS queue using the following Amazon SQS API actions and example Task state code for Step Functions workflows. Amazon SQS 805 AWS Step Functions Developer Guide To learn about integrating with AWS services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions. To learn more about receiving messages in Amazon SQS, see Receive and Delete Your Message in the Amazon Simple Queue Service Developer Guide. The following sample includes a Task state (JSONata) that sends an Amazon Simple Queue Service (Amazon SQS) message with optional MessageAttributes: { "StartAt": "Send to SQS", "States": { "Send to SQS": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage", "Arguments": { "QueueUrl": "https://sqs.us-east-1.amazonaws.com/account-id/myQueue", "MessageBody": "{% $states.input.message %}", "MessageAttributes": { "my_attribute_no_1": { "DataType": "String", "StringValue": "attribute1" }, "my_attribute_no_2": { "DataType": "String", "StringValue": "attribute2" } } }, "End": true } } } The following state machine includes a Task state that publishes to an Amazon SQS queue, and then waits for the task token to be returned. See Wait for a Callback with Task Token. { "StartAt":"Send message to SQS", "States":{ "Send message to SQS":{ "Type":"Task", "Resource":"arn:aws:states:::sqs:sendMessage.waitForTaskToken", Amazon SQS 806 AWS Step Functions "Arguments":{ Developer Guide "QueueUrl":"https://sqs.us-east-1.amazonaws.com/account-id/myQueue", "MessageBody":{ "Input" : "{% $states.input.message %}", "MyTaskToken" : "{% $states.context.Task.Token %}" } }, "End":true } } } Optimized Amazon SQS APIs • SendMessage Supported parameters: • DelaySeconds • MessageAttributes • MessageBody • MessageDeduplicationId • MessageGroupId • QueueUrl • Response syntax Parameters in Step Functions are expressed in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. Quota for input or result data When sending or receiving data between services, the maximum input or result for a task is 256 KiB of data as a UTF-8 encoded string. See Quotas related to state machine executions. Supported APIs 807 AWS Step Functions Developer Guide IAM policies for calling Amazon SQS The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more
|
step-functions-dg-215
|
step-functions-dg.pdf
| 215 |
in PascalCase Even if the native service API is in camelCase, for example the API action startSyncExecution, you specify parameters in PascalCase, such as: StateMachineArn. Quota for input or result data When sending or receiving data between services, the maximum input or result for a task is 256 KiB of data as a UTF-8 encoded string. See Quotas related to state machine executions. Supported APIs 807 AWS Step Functions Developer Guide IAM policies for calling Amazon SQS The following example templates show how AWS Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions. Static resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sqs:SendMessage" ], "Resource": [ "arn:aws:sqs:region:account-id:queueName" ] } ] } Dynamic resources { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sqs:SendMessage" ], "Resource": "*" } ] } IAM policies 808 AWS Step Functions Developer Guide Start a new AWS Step Functions state machine from a running execution Step Functions integrates with its own API as a service integration. Learn how to use Step Functions to start a new execution of a state machine directly from the task state of a running execution. When building new workflows, use nested workflow executions to reduce the complexity of your main workflows and to reuse common processes. Key features of Optimized Step Functions integration • The Run a Job (.sync) integration pattern is available. For more information, see the following: • Start from a Task • Integrating services • Passing parameters to a service API in Step Functions Optimized Step Functions APIs • StartExecution • Request Syntax • Supported Parameters • Input • Name • StateMachineArn • Response syntax Workflow Examples The following includes a Task state that starts an execution of another state machine and waits for it to complete. AWS Step Functions 809 AWS Step Functions { "Type":"Task", Developer Guide "Resource":"arn:aws:states:::states:startExecution.sync:2", "Arguments":{ "Input":{ "Comment": "Hello world!" }, "StateMachineArn":"arn:aws:states:region:account-id:stateMachine:HelloWorld", "Name":"ExecutionName" }, "End":true } The following includes a Task state that starts an execution of another state machine. { "Type":"Task", "Resource":"arn:aws:states:::states:startExecution", "Arguments":{ "Input":{ "Comment": "Hello world!" }, "StateMachineArn":"arn:aws:states:region:account-id:stateMachine:HelloWorld", "Name":"ExecutionName" }, "End":true } The following includes a Task state that implements the callback service integration pattern. { "Type":"Task", "Resource":"arn:aws:states:::states:startExecution.waitForTaskToken", "Arguments":{ "Input":{ "Comment": "Hello world!", "token": "{% $states.context.Task.Token %}" }, "StateMachineArn":"arn:aws:states:region:account-id:stateMachine:HelloWorld", "Name":"ExecutionName" }, "End":true Examples 810 AWS Step Functions } Developer Guide To associate a nested workflow execution with the parent execution that started it, pass a specially named parameter that includes the execution ID pulled from the Context object. When starting a nested execution, use a parameter named AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID. Pass the execution ID by appending .$ to the parameter name, and referencing the ID in the Context object with $$.Execution.Id. For more information, see Accessing the Context object. { "Type":"Task", "Resource":"arn:aws:states:::states:startExecution.sync", "Arguments":{ "Input":{ "Comment": "Hello world!", "AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$": "$$.Execution.Id" }, "StateMachineArn":"arn:aws:states:region:account-id:stateMachine:HelloWorld", "Name":"ExecutionName" }, "End":true } Nested state machines return the following: Resource startExecution.sync startExecution.sync:2 Output String JSON Both will wait for the nested state machine to complete, but they return different Output formats. For example, if you create a Lambda function that returns the object { "MyKey": "MyValue" }, you would get the following responses: For startExecution.sync: { <other fields> Examples 811 AWS Step Functions Developer Guide "Output": "{ \"MyKey\": \"MyValue\" }" } For startExecution.sync:2: { <other fields> "Output": { "MyKey": "MyValue" } } Configuring IAM permissions for nested state machines A parent state machine determines if a child state machine has completed execution using polling and events. Polling requires permission for states:DescribeExecution while events sent through EventBridge to Step Functions require permissions for events:PutTargets, events:PutRule, and events:DescribeRule. If these permissions are missing from your IAM role, there may be a delay before a parent state machine becomes aware of the completion of the child state machine's execution. For a state machine that calls StartExecution for a single nested workflow execution, use an IAM policy that limits permissions to that state machine. IAM policies for calling nested Step Functions workflows For a state machine that calls StartExecution for a single nested workflow execution, use an IAM policy that limits permissions to that state machine. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:StartExecution" ], "Resource": [ "arn:aws:states:region:account-id:stateMachine:stateMachineName" ] } IAM policies 812 AWS Step Functions ] } Developer Guide For more information, see the following: • Integrating services with Step Functions • Passing parameters to a service API in Step Functions • Start a new AWS Step Functions state machine from a running execution Synchronous { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:StartExecution" ], "Resource": [ "arn:aws:states:region:account-id:stateMachine:[[stateMachineName]]" ] }, { "Effect": "Allow", "Action": [ "states:DescribeExecution", "states:StopExecution" ], "Resource": [ "arn:aws:states:region:account-id:execution:stateMachineName:*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule",
|
step-functions-dg-216
|
step-functions-dg.pdf
| 216 |
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:StartExecution" ], "Resource": [ "arn:aws:states:region:account-id:stateMachine:stateMachineName" ] } IAM policies 812 AWS Step Functions ] } Developer Guide For more information, see the following: • Integrating services with Step Functions • Passing parameters to a service API in Step Functions • Start a new AWS Step Functions state machine from a running execution Synchronous { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:StartExecution" ], "Resource": [ "arn:aws:states:region:account-id:stateMachine:[[stateMachineName]]" ] }, { "Effect": "Allow", "Action": [ "states:DescribeExecution", "states:StopExecution" ], "Resource": [ "arn:aws:states:region:account-id:execution:stateMachineName:*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ IAM policies 813 AWS Step Functions Developer Guide "arn:aws:events:region:account-id:rule/ StepFunctionsGetEventsForStepFunctionsExecutionRule" ] } ] } Asynchronous { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:StartExecution" ], "Resource": [ "arn:aws:states:region:account-id:stateMachine:stateMachineName" ] } ] } ARN types required In the policy for Synchronous, note that states:StartExecution requires a state machine ARN whereas states:DescribeExecution and states:StopExecution require an execution ARN. If you mistakenly combine all three actions, the JSON will be valid but the IAM policy will be incorrect. An incorrect policy can cause stuck workflows and/or access issues during workflow execution. For more information about nested workflow executions, see Start workflow executions from a task state in Step Functions. IAM policies 814 AWS Step Functions Developer Guide Security in AWS Step Functions Cloud security at AWS is the highest priority. As an AWS customer, you benefit from a data center and network architecture that is built to meet the requirements of the most security-sensitive organizations. Security is a shared responsibility between AWS and you. The shared responsibility model describes this as security of the cloud and security in the cloud: • Security of the cloud – AWS is responsible for protecting the infrastructure that runs AWS services in the AWS Cloud. AWS also provides you with services that you can use securely. Third-party auditors regularly test and verify the effectiveness of our security as part of the AWS compliance programs. To learn about the compliance programs that apply to AWS Step Functions, see AWS Services in Scope by Compliance Program. • Security in the cloud – Your responsibility is determined by the AWS service that you use. You are also responsible for other factors including the sensitivity of your data, your company’s requirements, and applicable laws and regulations. This documentation helps you understand how to apply the shared responsibility model when using Step Functions. The following topics show you how to configure Step Functions to meet your security and compliance objectives. You also learn how to use other AWS services that help you to monitor and secure your Step Functions resources. Step Functions uses IAM to control access to other AWS services and resources. For an overview of how IAM works, see Overview of Access Management in the IAM User Guide. For an overview of security credentials, see AWS Security Credentials in the Amazon Web Services General Reference. Data protection and encryption in Step Functions The AWS shared responsibility model applies to data protection in AWS Step Functions. As described in this model, AWS is responsible for protecting the global infrastructure that runs all of the AWS Cloud. You are responsible for maintaining control over your content that is hosted on this infrastructure. You are also responsible for the security configuration and management tasks for the AWS services that you use. For more information about data privacy, see the Data Privacy FAQ. For information about data protection in Europe, see the AWS Shared Responsibility Model and GDPR blog post on the AWS Security Blog. Data protection 815 AWS Step Functions Developer Guide For data protection purposes, we recommend that you protect AWS account credentials and set up individual users with AWS IAM Identity Center or AWS Identity and Access Management (IAM). That way, each user is given only the permissions necessary to fulfill their job duties. We also recommend that you secure your data in the following ways: • Use multi-factor authentication (MFA) with each account. • Use SSL/TLS to communicate with AWS resources. We require TLS 1.2 and recommend TLS 1.3. • Set up API and user activity logging with AWS CloudTrail. For information about using CloudTrail trails to capture AWS activities, see Working with CloudTrail trails in the AWS CloudTrail User Guide. • Use AWS encryption solutions, along with all default security controls within AWS services. • Use advanced managed security services such as Amazon Macie, which assists in discovering and securing sensitive data that is stored in Amazon S3. • If you require FIPS 140-3 validated cryptographic modules when accessing AWS through a command line interface or an API, use a FIPS endpoint. For more information about the available FIPS endpoints, see Federal Information Processing Standard (FIPS) 140-3. We strongly recommend that you never
|
step-functions-dg-217
|
step-functions-dg.pdf
| 217 |
CloudTrail trails to capture AWS activities, see Working with CloudTrail trails in the AWS CloudTrail User Guide. • Use AWS encryption solutions, along with all default security controls within AWS services. • Use advanced managed security services such as Amazon Macie, which assists in discovering and securing sensitive data that is stored in Amazon S3. • If you require FIPS 140-3 validated cryptographic modules when accessing AWS through a command line interface or an API, use a FIPS endpoint. For more information about the available FIPS endpoints, see Federal Information Processing Standard (FIPS) 140-3. We strongly recommend that you never put confidential or sensitive information, such as your customers' email addresses, into tags or free-form text fields such as a Name field. This includes when you work with Step Functions or other AWS services using the console, API, AWS CLI, or AWS SDKs. Any data that you enter into tags or free-form text fields used for names may be used for billing or diagnostic logs. If you provide a URL to an external server, we strongly recommend that you do not include credentials information in the URL to validate your request to that server. With customer managed AWS KMS keys, you can secure customer data that includes protected health information (PHI) from unauthorized access. Step Functions is integrated with CloudTrail, so you can view and audit the most recent events in the CloudTrail console in the event history. Topics • Data at rest encryption in Step Functions • Data in transit encryption in Step Functions Data protection 816 AWS Step Functions Developer Guide Data at rest encryption in Step Functions Read the blog Read about customer managed keys in Strengthening data security with a customer- managed AWS KMS key AWS Step Functions always encrypts your data at rest using transparent server-side encryption. Encryption of data at rest by default reduces the operational overhead and complexity involved in protecting sensitive data. You can build security-sensitive applications that meet strict encryption compliance and regulatory requirements. Although you can't disable this layer of encryption or select an alternate encryption type, you can add a second layer of encryption over the existing AWS owned encryption keys by choosing a customer managed key when you create your state machine and activity resources: • Customer managed keys — Step Functions supports the use of a symmetric customer managed key that you create, own, and manage to add a second layer of encryption over the existing AWS owned encryption. Because you have full control of this layer of encryption, you can perform such tasks as: • Establishing and maintaining key policies • Establishing and maintaining IAM policies and grants • Enabling and disabling key policies • Rotating key cryptographic material • Adding tags • Creating key aliases • Scheduling keys for deletion For information, see customer managed key in the AWS Key Management Service Developer Guide. You can encrypt your data using a customer-managed key for AWS Step Functions state machines and activities. You can configure a symmetric AWS KMS key and data key reuse period when creating or updating a State Machine, and when creating an Activity. The execution history and Data at rest encryption 817 AWS Step Functions Developer Guide state machine definition will be encrypted with the key applied to the State Machine. Activity inputs will be encrypted with the key applied to the Activity. With customer managed AWS KMS keys, you can secure customer data that includes protected health information (PHI) from unauthorized access. Step Functions is integrated with CloudTrail, so you can view and audit the most recent events in the CloudTrail console in the event history. For information on AWS KMS, see What is AWS Key Management Service? Note Step Functions automatically enables encryption at rest using AWS owned keys at no charge. However, AWS KMS charges apply when using a customer managed key. For information about pricing, see AWS Key Management Service pricing. Encrypting with a customer managed key Step Functions decrypts payload data with your customer managed AWS KMS key before passing it to another service to perform a task. The data is encrypted in transit using Transport Layer Security (TLS). When data is returned from an integrated service, Step Functions encrypts the data with your customer managed AWS KMS key. You can use the same key to consistently apply encryption across many AWS services. You can use a customer managed key with the following resources: • State Machine - both Standard and Express workflow types • Activity You can specify the data key by entering a KMS key ID, which Step Functions uses to encrypt your data. • KMS key ID — key identifier for an AWS KMS customer managed key in the form of a key ID, key ARN, alias name, or alias ARN. Data at rest
|
step-functions-dg-218
|
step-functions-dg.pdf
| 218 |
Step Functions encrypts the data with your customer managed AWS KMS key. You can use the same key to consistently apply encryption across many AWS services. You can use a customer managed key with the following resources: • State Machine - both Standard and Express workflow types • Activity You can specify the data key by entering a KMS key ID, which Step Functions uses to encrypt your data. • KMS key ID — key identifier for an AWS KMS customer managed key in the form of a key ID, key ARN, alias name, or alias ARN. Data at rest encryption 818 AWS Step Functions Developer Guide Create a State Machine with a customer managed key Prerequisite: Before you can create a state machine with customer managed AWS KMS keys, your user or role must have AWS KMS permissions to DescribeKey and GenerateDataKey. You can perform the following steps in the AWS console, through the API, or by provisioning infrastructure through AWS CloudFormation resources. (CloudFormation examples are presented later in this guide.) Step 1: Create AWS KMS key You can create a symmetric customer managed key with the AWS KMS console or AWS KMS APIs. To create a symmetric customer managed key Follow the steps for Creating symmetric customer managed key in the AWS Key Management Service Developer Guide. Note Optional: When creating a key, you may choose Key administrators. The selected users or roles will be granted access manage the key, such as enabling or disabling the key through the API. You may also choose Key users. These users or roles will be granted the ability to use the AWS KMS key in cryptographic operations. Step 2: Set AWS KMS key policy Key policies control access to your customer managed key. Every customer managed key must have exactly one key policy, which contains statements that determine who can use the key and how they can use it. When you create your customer managed key, you can specify a key policy. For information, see Managing access to customer managed keys in the AWS Key Management Service Developer Guide. The following is an example AWS KMS key policy from console, without Key administrators or Key users: { "Version": "2012-10-17", "Id": "key-consolepolicy-1", "Statement": [ Data at rest encryption 819 AWS Step Functions { "Sid": "Enable IAM User Permissions for the key", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:root" Developer Guide }, "Action": "kms:*", "Resource": "*" } ] } See the AWS Key Management Service Developer Guide for information about specifying permissions in a policy and troubleshooting key access. Step 3: Add key policy to encrypt CloudWatch logs Step Functions is integrated with CloudWatch for logging and monitoring. When you enable server-side encryption for your state machine using your own KMS key and enable CloudWatch Log integration, you must allow delivery.logs.amazonaws.com to do kms:Decrypt action from your AWS KMS key policy: { "Sid": "Enable log service delivery for integrations", "Effect": "Allow", "Principal": { "Service": "delivery.logs.amazonaws.com" }, "Action": "kms:Decrypt", "Resource": "*" } If you enable state machine encryption with a AWS KMS key, and your state machine has CloudWatch Logs integration enabled, the state machine's execution role needs the following policy: { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowKMSPermissionForCloudWatchLogGroup", "Effect": "Allow", Data at rest encryption 820 AWS Step Functions Developer Guide "Action": "kms:GenerateDataKey", "Resource": "arn:aws:kms:region:account-id:key/keyId", "Condition": { "StringEquals": { "kms:EncryptionContext:SourceArn": "arn:aws:logs:region:account-id:*" } } } ] } Step 4: Encrypt CloudWatch Log Group (Optional) You can enable encryption of the logs in a CloudWatch Log Group using your own AWS KMS key. To do that, you must also add the following policy to that AWS KMS key. Note You can choose the same or different AWS KMS keys to encrypt your logs and your state machine definitions. { "Id": "key-consolepolicy-logging", "Version": "2012-10-17", "Statement": [ { "Sid": "Enable log service for a single log group", "Effect": "Allow", "Principal": { "Service": "logs.region.amazonaws.com" }, "Action": [ "kms:Encrypt*", "kms:Decrypt*", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:Describe*" ], "Resource": "*", "Condition": { "ArnEquals": { Data at rest encryption 821 AWS Step Functions Developer Guide "kms:EncryptionContext:aws:logs:arn": "arn:aws:logs:region:account-id:log- group:log-group-name" } } } ] } Note The Condition section restricts the AWS KMS key to a single log group ARN. Note See CloudWatch logs documentation to learn more about setting permissions on the AWS KMS key for your log group. Step 5: Create state machine After you have created a key and set up the policy, you can use the key to create a new state machine. When creating the state machine, choose Additional configuration, then choose to encrypt with customer managed key. You can then select your key and set the data key reuse period from 1 min to 15 minutes. Optionally, you can enable logging by setting a log level and choosing to encrypt the log group with your AWS KMS key. Note You can only
|
step-functions-dg-219
|
step-functions-dg.pdf
| 219 |
about setting permissions on the AWS KMS key for your log group. Step 5: Create state machine After you have created a key and set up the policy, you can use the key to create a new state machine. When creating the state machine, choose Additional configuration, then choose to encrypt with customer managed key. You can then select your key and set the data key reuse period from 1 min to 15 minutes. Optionally, you can enable logging by setting a log level and choosing to encrypt the log group with your AWS KMS key. Note You can only enable encryption on a new log group in the Step Functions console. To learn how to associate a AWS KMS key with an existing log group, see Associate a AWS KMS key with a log group. To successfully start an execution for Standard workflows and Asynchronous Express workflows with customer managed keys, your execution role requires kms:Decrypt and Data at rest encryption 822 AWS Step Functions Developer Guide kms:GenerateDataKey permissions. The execution role for Synchronous Express execution requires kms:Decrypt. When you create a state machine in the console and choose Create a new role, these permissions are automatically included for you. The following is an example execution role policy: { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowKMSPermissionsForStepFunctionsWorkflowExecutions", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": [ "arn:aws:kms:region:account-id:key/keyId" ], "Condition": { "StringEquals": { "kms:EncryptionContext:aws:states:stateMachineArn": [ "arn:aws:states:region:account-id:stateMachine:stateMachineName" ] } } } ] } Step 6: Invoke state machine encrypted with your AWS KMS key You can invoke your encrypted state machine as you normally would, and your data will be encrypted with your customer managed key. Create an Activity with a customer managed key Creating an Step Functions Activity with a customer managed key is similar to creating a state machine with a customer managed key. Before you can create a activity with customer managed AWS KMS keys, your user or role only needs AWS KMS permissions to DescribeKey. During creation of the Activity, you choose the key and set the encryption configuration parameters. Data at rest encryption 823 AWS Step Functions Developer Guide Note that Step Functions Activity resources remain immutable. You cannot update the encryptionConfiguration for an activity ARN of an existing activity; you must create a new Activity resource. Callers to the Activity API endpoints must have kms:DescribeKey permissions to successfully create an activity with a AWS KMS key. When customer managed key encryption is enabled on an Activity Task, the state machine execution role will require kms:GenerateDataKey and kms:Decrypt permission for the activity key. If you are creating this state machine from the Step Functions console, the auto role creation feature will add these permissions. { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowKMSPermissionsForStepFunctionsActivities", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": [ "arn:aws:kms:region:account-id:key/keyId" ], "Condition": { "StringEquals": { "kms:EncryptionContext:aws:states:activityArn": [ "arn:aws:states:region:account-id:activity:activityName" ] } } } ] } Scope down AWS KMS permission policies with conditions You can use the encryption context in key policies and IAM policies as conditions to control access to your symmetric customer managed key. To limit the use of a AWS KMS key to requests from Step Functions on behalf of a specific role, you can use the kms:ViaService condition. Data at rest encryption 824 AWS Step Functions Developer Guide Scoping with encryption context An encryption context is an optional set of key-value pairs that contain additional contextual information about the data. AWS KMS uses the encryption context as additional authenticated data to support authenticated encryption. When you include an encryption context in a request to encrypt data, AWS KMS binds the encryption context to the encrypted data. To decrypt data, you include the same encryption context in the request. Step Functions provides an encryption context in AWS KMS cryptographic operations, where the key is aws:states:stateMachineArn for State Machines or aws:states:activityArn for Activities, and the value is the resource Amazon Resource Name (ARN). Example "encryptionContext": {"aws:states:stateMachineArn": "arn:aws:states:region:account- id:stateMachine:stateMachineName"} Example "encryptionContext": {"aws:states:activityArn": "arn:aws:states:region:account- id:activity:activityName"} The following example shows how to limit the use of a AWS KMS key for execution roles to specific state machines with kms:EncryptionContext and the aws:states:stateMachineArn context key: { "Version": "2012-10-17", "Statement": [ { "Sid": "Allow KMS Permissions for StepFunctionsWorkflowExecutions", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": [ "arn:aws:kms:region:account-id:key/keyId" Data at rest encryption 825 AWS Step Functions ], "Condition": { "StringEquals": { "kms:EncryptionContext:aws:states:stateMachineArn": "arn:aws:states:region:account-id:stateMachine:stateMachineName" Developer Guide } } } ] } Scoping with kms:ViaService The kms:ViaService condition key limits use of an AWS Key Management Service key to requests from specified AWS services. The following example policy uses the kms:ViaService condition to allow the AWS KMS key to be used for specific actions only when the request originates from Step Functions in the ca- central-1 region, acting on behalf of the ExampleRole: { "Version": "2012-10-17", "Statement": [ { "Sid": "Allow
|
step-functions-dg-220
|
step-functions-dg.pdf
| 220 |
"Allow", "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": [ "arn:aws:kms:region:account-id:key/keyId" Data at rest encryption 825 AWS Step Functions ], "Condition": { "StringEquals": { "kms:EncryptionContext:aws:states:stateMachineArn": "arn:aws:states:region:account-id:stateMachine:stateMachineName" Developer Guide } } } ] } Scoping with kms:ViaService The kms:ViaService condition key limits use of an AWS Key Management Service key to requests from specified AWS services. The following example policy uses the kms:ViaService condition to allow the AWS KMS key to be used for specific actions only when the request originates from Step Functions in the ca- central-1 region, acting on behalf of the ExampleRole: { "Version": "2012-10-17", "Statement": [ { "Sid": "Allow access for Key Administrators in a region", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::account-id:role/ExampleRole" }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "*", "Condition": { "StringEquals": { "kms:ViaService": "states.us-east-1.amazonaws.com" } } } ] } Data at rest encryption 826 AWS Step Functions Note Developer Guide The kms:ViaService condition is only applicable when AWS KMS permissions are required by the API caller (for example, CreateStateMachine, CreateActivity, GetActivityTask, etc.). Adding kms:ViaService condition to an execution role can prevent a new execution from starting or cause a running execution to fail. Required permissions for API callers To call Step Functions API actions that return encrypted data, callers need AWS KMS permissions. Alternatively, some API actions have an option (METADATA_ONLY) to return only metadata, removing the requirement for AWS KMS permissions. Refer to the Step Functions API for information. For an execution to successfully complete when using customer managed key encryption, the execution role needs to be granted kms:GenerateDataKey and kms:Decrypt permissions for AWS KMS keys used by the state machine. The following table shows the AWS KMS permissions you need to provide to Step Functions API callers for the APIs using a State Machine's AWS KMS key. You can provide the permissions to the key policy or IAM policy for the role. APIs using State Machine's AWS KMS key Required by Caller CreateStateMachine kms:DescribeKey, kms:GenerateDataKey UpdateStateMachine kms:DescribeKey, kms:GenerateDataKey DescribeStateMachine kms:Decrypt DescribeStateMachineForExecution kms:Decrypt StartExecution -- StartSyncExecution kms:Decrypt SendTaskSuccess SendTaskFailure -- -- Data at rest encryption 827 AWS Step Functions StopExecution RedriveExecution DescribeExecution GetExecutionHistory -- -- kms:Decrypt kms:Decrypt Developer Guide The following table shows the AWS KMS permissions you need to provide to Step Functions API callers for the APIs using an Activity's AWS KMS key. You can provide the permissions in the key policy or IAM policy for the role. APIs using Activity's AWS KMS key Required by Caller CreateActivity GetActivityTask kms:DescribeKey kms:Decrypt When do I grant permissions to the Caller or the Execution role? When an IAM role or user calls the Step Functions API, the Step Functions service calls AWS KMS on behalf of the API caller. In this case, you must grant AWS KMS permission to the API caller. When an execution role calls AWS KMS directly, you must grant AWS KMS permissions on the execution role. AWS CloudFormation resources for encryption configuration AWS CloudFormation resource types for Step Functions can provision state machine and activity resources with encryption configurations. By default, Step Functions provides transparent server-side encryption. Both AWS::StepFunctions::Activity and AWS::StepFunctions::StateMachine accept an optional EncryptionConfiguration property which can configure a customer managed AWS KMS key for server-side encryption. Data at rest encryption 828 AWS Step Functions Developer Guide Prerequisite: Before you can create a state machine with customer managed AWS KMS keys, your user or role must have AWS KMS permissions to DescribeKey and GenerateDataKey. Updates to StateMachine requires No interruption. Updates to Activity resources requires: Replacement. To declare an EncryptionConfiguration property in your AWS CloudFormation template, use the following syntax: JSON { "KmsKeyId" : String, "KmsDataKeyReusePeriodSeconds" : Integer, "Type" : String } YAML KmsKeyId: String KmsDataKeyReusePeriodSeconds: Integer Type: String Properties • Type - Encryption option for the state machine or activity. Allowed values: CUSTOMER_MANAGED_KMS_KEY | AWS_OWNED_KEY • KmsKeyId - Alias, alias ARN, key ID, or key ARN of the symmetric encryption AWS KMS key that encrypts the data key. To specify a AWS KMS key in a different AWS account, the customer must use the key ARN or alias ARN. For information regarding kmsKeyId, see KeyId in AWS KMS docs. • KmsDataKeyReusePeriodSeconds - Maximum duration for which SFN will reuse data keys. When the period expires, Step Functions will call GenerateDataKey. This setting can only be set when Type is CUSTOMER_MANAGED_KMS_KEY. The value can range from 60-900 seconds. Default is 300 seconds. AWS CloudFormation examples Example: StateMachine with customer managed key AWSTemplateFormatVersion: '2010-09-09' Data at rest encryption 829 AWS Step Functions Developer Guide Description: An example template for a Step Functions State Machine. Resources: MyStateMachine: Type: AWS::StepFunctions::StateMachine Properties: StateMachineName: HelloWorld-StateMachine Definition: StartAt: PassState States: PassState: Type: Pass End: true RoleArn: !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/example" EncryptionConfiguration: KmsKeyId: !Ref MyKmsKey KmsDataKeyReusePeriodSeconds: 100 Type: CUSTOMER_MANAGED_KMS_KEY MyKmsKey: Type: AWS::KMS::Key Properties: Description: Symmetric KMS key used for encryption/decryption Example: Activity with customer managed key AWSTemplateFormatVersion: '2010-09-09' Description: An
|
step-functions-dg-221
|
step-functions-dg.pdf
| 221 |
This setting can only be set when Type is CUSTOMER_MANAGED_KMS_KEY. The value can range from 60-900 seconds. Default is 300 seconds. AWS CloudFormation examples Example: StateMachine with customer managed key AWSTemplateFormatVersion: '2010-09-09' Data at rest encryption 829 AWS Step Functions Developer Guide Description: An example template for a Step Functions State Machine. Resources: MyStateMachine: Type: AWS::StepFunctions::StateMachine Properties: StateMachineName: HelloWorld-StateMachine Definition: StartAt: PassState States: PassState: Type: Pass End: true RoleArn: !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/example" EncryptionConfiguration: KmsKeyId: !Ref MyKmsKey KmsDataKeyReusePeriodSeconds: 100 Type: CUSTOMER_MANAGED_KMS_KEY MyKmsKey: Type: AWS::KMS::Key Properties: Description: Symmetric KMS key used for encryption/decryption Example: Activity with customer managed key AWSTemplateFormatVersion: '2010-09-09' Description: An example template for a Step Functions Activity. Resources: Activity: Type: AWS::StepFunctions::Activity Properties: Name: ActivityWithKmsEncryption EncryptionConfiguration: KmsKeyId: !Ref MyKmsKey KmsDataKeyReusePeriodSeconds: 100 Type: CUSTOMER_MANAGED_KMS_KEY MyKmsKey: Type: AWS::KMS::Key Properties: Description: Symmetric KMS key used for encryption/decryption Data at rest encryption 830 AWS Step Functions Developer Guide Updating encryption for an Activity requires creating a new resource Activity configuration is immutable, and resource names must be unique. To set customer managed keys for encryption, you must create a new Activity. If you attempt to change the configuration in your CFN template for an existing activity, you will receive an ActivityAlreadyExists exception. To update your activity to include customer managed keys, set a new activity name within your CFN template. The following shows an example that creates a new activity with a customer managed key configuration: Existing activity definition AWSTemplateFormatVersion: '2010-09-09' Description: An example template for a new Step Functions Activity. Resources: Activity: Type: AWS::StepFunctions::Activity Properties: Name: ActivityName EncryptionConfiguration: Type: AWS_OWNED_KEY New activity definition AWSTemplateFormatVersion: '2010-09-09' Description: An example template for a Step Functions Activity. Resources: Activity: Type: AWS::StepFunctions::Activity Properties: Name: ActivityWithKmsEncryption EncryptionConfiguration: KmsKeyId: !Ref MyKmsKey KmsDataKeyReusePeriodSeconds: 100 Type: CUSTOMER_MANAGED_KMS_KEY MyKmsKey: Type: AWS::KMS::Key Properties: Description: Symmetric KMS key used for encryption/decryption Data at rest encryption 831 AWS Step Functions Developer Guide Monitoring your encryption key usage When you use an AWS KMS customer managed key to encrypt your Step Functions resources, you can use CloudTrail to track requests that Step Functions sends to AWS KMS. You can also use the encryption context in audit records and logs to identify how the customer managed key is being used. The encryption context also appears in logs generated by AWS CloudTrail. The following examples are CloudTrail events for Decrypt, DescribeKey, and GenerateDataKey to monitor AWS KMS operations called by Step Functions to access data encrypted by your customer managed key: Decrypt When you access an encrypted state machine or activity, Step Functions calls the Decrypt operation to use the stored encrypted data key to access the encrypted data. The following example event records the Decrypt operation: { "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "111122223333:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "accessKeyId": "ASIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "111122223333:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "userName": "Admin" }, "attributes": { "creationDate": "2024-07-05T21:06:27Z", "mfaAuthenticated": "false" } }, "invokedBy": "states.amazonaws.com" }, Data at rest encryption 832 AWS Step Functions Developer Guide "eventTime": "2024-07-05T21:12:21Z", "eventSource": "kms.amazonaws.com", "eventName": "Decrypt", "awsRegion": "aa-example-1", "sourceIPAddress": "states.amazonaws.com", "userAgent": "states.amazonaws.com", "requestParameters": { "encryptionAlgorithm": "SYMMETRIC_DEFAULT", "keyId": "arn:aws:kms:aa-example-1:111122223333:key/a1b2c3d4-5678-90ab-cdef- EXAMPLE11111", "encryptionContext": { "aws:states:stateMachineArn": "arn:aws:states:aa- example-1:111122223333:stateMachine:example1" } }, "responseElements": null, "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "readOnly": true, "resources": [ { "accountId": "111122223333", "type": "AWS::KMS::Key", "ARN": "arn:aws:kms:aa-example-1:111122223333:key/a1b2c3d4-5678-90ab- cdef-EXAMPLE11111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" } DescribeKey Step Functions uses the DescribeKey operation to verify if the AWS KMS customer managed key associated with your State Machine or Activity exists in the account and region. The following example event records the DescribeKeyoperation: { "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", Data at rest encryption 833 AWS Step Functions Developer Guide "principalId": "111122223333:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "accessKeyId": "ASIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "111122223333:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "userName": "Admin" }, "attributes": { "creationDate": "2024-07-05T21:06:27Z", "mfaAuthenticated": "false" } }, "invokedBy": "states.amazonaws.com" }, "eventTime": "2024-07-05T21:12:21Z", "eventSource": "kms.amazonaws.com", "eventName": "DescribeKey", "awsRegion": "aa-example-1", "sourceIPAddress": "states.amazonaws.com", "userAgent": "states.amazonaws.com", "requestParameters": { "keyId": "arn:aws:kms:aa-example-1:111122223333:key/a1b2c3d4-5678-90ab-cdef- EXAMPLE11111" }, "responseElements": null, "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "readOnly": true, "resources": [ { "accountId": "111122223333", "type": "AWS::KMS::Key", "ARN": "arn:aws:kms:aa-example-1:111122223333:key/a1b2c3d4-5678-90ab-cdef- EXAMPLE11111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", Data at rest encryption 834 AWS Step Functions Developer Guide "eventCategory": "Management", "sessionCredentialFromConsole": "true" } GenerateDataKey When you enable an AWS KMS customer managed key for your State Machine or Activity, Step Functions sends a GenerateDataKey request to get a data key to the encrypt state machine definition or execution data. The following example event records the GenerateDataKeyoperation: { "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "111122223333:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "accessKeyId": "ASIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "111122223333:Sampleuser01", "arn": "arn:aws:iam::111122223333:role/Admin", "accountId": "111122223333", "userName": "Admin" }, "attributes": { "creationDate": "2024-07-05T21:06:27Z", "mfaAuthenticated": "false" } }, "invokedBy": "states.amazonaws.com" }, "eventTime": "2024-07-05T21:12:21Z", "eventSource": "kms.amazonaws.com", "eventName": "GenerateDataKey", "awsRegion": "aa-example-1", "sourceIPAddress": "states.amazonaws.com", "userAgent": "states.amazonaws.com", "requestParameters": { "keySpec": "AES_256", Data at rest encryption 835 AWS Step Functions Developer Guide
|
step-functions-dg-222
|
step-functions-dg.pdf
| 222 |
for your State Machine or Activity, Step Functions sends a GenerateDataKey request to get a data key to the encrypt state machine definition or execution data. The following example event records the GenerateDataKeyoperation: { "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "111122223333:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "accessKeyId": "ASIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "111122223333:Sampleuser01", "arn": "arn:aws:iam::111122223333:role/Admin", "accountId": "111122223333", "userName": "Admin" }, "attributes": { "creationDate": "2024-07-05T21:06:27Z", "mfaAuthenticated": "false" } }, "invokedBy": "states.amazonaws.com" }, "eventTime": "2024-07-05T21:12:21Z", "eventSource": "kms.amazonaws.com", "eventName": "GenerateDataKey", "awsRegion": "aa-example-1", "sourceIPAddress": "states.amazonaws.com", "userAgent": "states.amazonaws.com", "requestParameters": { "keySpec": "AES_256", Data at rest encryption 835 AWS Step Functions Developer Guide "encryptionContext": { "aws:states:stateMachineArn": "arn:aws:states:aa- example-1:111122223333:stateMachine:example1" }, "keyId": "arn:aws:kms:aa-example-1:111122223333:key/a1b2c3d4-5678-90ab-cdef- EXAMPLE11111" }, "responseElements": null, "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "readOnly": true, "resources": [ { "accountId": "111122223333", "type": "AWS::KMS::Key", "ARN": "arn:aws:kms:aa-example-1:111122223333:key/a1b2c3d4-5678-90ab-cdef- EXAMPLE11111" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" } FAQs What happens if my key is marked for deletion or deleted in AWS KMS? If the key is deleted or marked for deletion in AWS KMS, any related running executions will fail. New executions cannot be started until you remove or change the key associated with the workflow. After a AWS KMS key is deleted, all encrypted data associated with the workflow execution will remain encrypted and can no longer be decrypted, making the data unrecoverable. What happens if a AWS KMS key is disabled in AWS KMS? If a AWS KMS key is disabled in AWS KMS, any related running executions will fail. New executions cannot be started. You can no longer decrypt the data encrypted under that disabled AWS KMS key until it is re-enabled. Data at rest encryption 836 AWS Step Functions Developer Guide What happens to Execution Status change events sent to EventBridge? Execution Input, Output, Error, and Cause will not be included for execution status change events for workflows that are encrypted using your customer managed AWS KMS key. Learn more For information about data encryption at rest, see AWS Key Management Service concepts and security best practices for AWS Key Management Service in the AWS Key Management Service Developer Guide. Data in transit encryption in Step Functions Step Functions encrypts data in transit between the service and other integrated AWS services (see Integrating services with Step Functions). All data that passes between Step Functions and integrated services is encrypted using Transport Layer Security (TLS). Identity and Access Management in Step Functions The following sections provide details on how you can use AWS Identity and Access Management (IAM) and Step Functions to help secure your resources by controlling who can access them. For example, you will learn how to provide AWS Step Functions with credentials with permissions to access AWS resources, such as retrieving event data from other AWS resources. AWS Identity and Access Management (IAM) is an AWS service that helps an administrator securely control access to AWS resources. IAM administrators control who can be authenticated (signed in) and authorized (have permissions) to use Step Functions resources. IAM is an AWS service that you can use with no additional charge. Audience How you use AWS Identity and Access Management (IAM) differs, depending on the work that you do in Step Functions. Service user – If you use the Step Functions service to do your job, then your administrator provides you with the credentials and permissions that you need. As you use more Step Functions features to do your work, you might need additional permissions. Understanding how access is managed can help you request the right permissions from your administrator. If you cannot access a feature in Step Functions, see Troubleshooting identity and access issues in Step Functions. Data in transit encryption 837 AWS Step Functions Developer Guide Service administrator – If you're in charge of Step Functions resources at your company, you probably have full access to Step Functions. It's your job to determine which Step Functions features and resources your service users should access. You must then submit requests to your IAM administrator to change the permissions of your service users. Review the information on this page to understand the basic concepts of IAM. To learn more about how your company can use IAM with Step Functions, see How AWS Step Functions works with IAM. IAM administrator – If you're an IAM administrator, you might want to learn details about how you can write policies to manage access to Step Functions. To view example Step Functions identity- based policies that you can use in IAM, see Identity-based policy examples for AWS Step Functions. Authenticating with identities Authentication is how you sign in to AWS using your identity credentials. You must be authenticated (signed in to AWS) as the AWS account root user, as an IAM user, or by assuming an IAM role. You can sign in to AWS as a federated identity by
|
step-functions-dg-223
|
step-functions-dg.pdf
| 223 |
with IAM. IAM administrator – If you're an IAM administrator, you might want to learn details about how you can write policies to manage access to Step Functions. To view example Step Functions identity- based policies that you can use in IAM, see Identity-based policy examples for AWS Step Functions. Authenticating with identities Authentication is how you sign in to AWS using your identity credentials. You must be authenticated (signed in to AWS) as the AWS account root user, as an IAM user, or by assuming an IAM role. You can sign in to AWS as a federated identity by using credentials provided through an identity source. AWS IAM Identity Center (IAM Identity Center) users, your company's single sign-on authentication, and your Google or Facebook credentials are examples of federated identities. When you sign in as a federated identity, your administrator previously set up identity federation using IAM roles. When you access AWS by using federation, you are indirectly assuming a role. Depending on the type of user you are, you can sign in to the AWS Management Console or the AWS access portal. For more information about signing in to AWS, see How to sign in to your AWS account in the AWS Sign-In User Guide. If you access AWS programmatically, AWS provides a software development kit (SDK) and a command line interface (CLI) to cryptographically sign your requests by using your credentials. If you don't use AWS tools, you must sign requests yourself. For more information about using the recommended method to sign requests yourself, see AWS Signature Version 4 for API requests in the IAM User Guide. Regardless of the authentication method that you use, you might be required to provide additional security information. For example, AWS recommends that you use multi-factor authentication (MFA) to increase the security of your account. To learn more, see Multi-factor authentication in the AWS IAM Identity Center User Guide and AWS Multi-factor authentication in IAM in the IAM User Guide. Authenticating with identities 838 AWS Step Functions AWS account root user Developer Guide When you create an AWS account, you begin with one sign-in identity that has complete access to all AWS services and resources in the account. This identity is called the AWS account root user and is accessed by signing in with the email address and password that you used to create the account. We strongly recommend that you don't use the root user for your everyday tasks. Safeguard your root user credentials and use them to perform the tasks that only the root user can perform. For the complete list of tasks that require you to sign in as the root user, see Tasks that require root user credentials in the IAM User Guide. Federated identity As a best practice, require human users, including users that require administrator access, to use federation with an identity provider to access AWS services by using temporary credentials. A federated identity is a user from your enterprise user directory, a web identity provider, the AWS Directory Service, the Identity Center directory, or any user that accesses AWS services by using credentials provided through an identity source. When federated identities access AWS accounts, they assume roles, and the roles provide temporary credentials. For centralized access management, we recommend that you use AWS IAM Identity Center. You can create users and groups in IAM Identity Center, or you can connect and synchronize to a set of users and groups in your own identity source for use across all your AWS accounts and applications. For information about IAM Identity Center, see What is IAM Identity Center? in the AWS IAM Identity Center User Guide. IAM users and groups An IAM user is an identity within your AWS account that has specific permissions for a single person or application. Where possible, we recommend relying on temporary credentials instead of creating IAM users who have long-term credentials such as passwords and access keys. However, if you have specific use cases that require long-term credentials with IAM users, we recommend that you rotate access keys. For more information, see Rotate access keys regularly for use cases that require long- term credentials in the IAM User Guide. An IAM group is an identity that specifies a collection of IAM users. You can't sign in as a group. You can use groups to specify permissions for multiple users at a time. Groups make permissions easier to manage for large sets of users. For example, you could have a group named IAMAdmins and give that group permissions to administer IAM resources. Authenticating with identities 839 AWS Step Functions Developer Guide Users are different from roles. A user is uniquely associated with one person or application, but a role is intended to be assumable by anyone who needs it. Users have permanent
|
step-functions-dg-224
|
step-functions-dg.pdf
| 224 |
group is an identity that specifies a collection of IAM users. You can't sign in as a group. You can use groups to specify permissions for multiple users at a time. Groups make permissions easier to manage for large sets of users. For example, you could have a group named IAMAdmins and give that group permissions to administer IAM resources. Authenticating with identities 839 AWS Step Functions Developer Guide Users are different from roles. A user is uniquely associated with one person or application, but a role is intended to be assumable by anyone who needs it. Users have permanent long-term credentials, but roles provide temporary credentials. To learn more, see Use cases for IAM users in the IAM User Guide. IAM roles An IAM role is an identity within your AWS account that has specific permissions. It is similar to an IAM user, but is not associated with a specific person. To temporarily assume an IAM role in the AWS Management Console, you can switch from a user to an IAM role (console). You can assume a role by calling an AWS CLI or AWS API operation or by using a custom URL. For more information about methods for using roles, see Methods to assume a role in the IAM User Guide. IAM roles with temporary credentials are useful in the following situations: • Federated user access – To assign permissions to a federated identity, you create a role and define permissions for the role. When a federated identity authenticates, the identity is associated with the role and is granted the permissions that are defined by the role. For information about roles for federation, see Create a role for a third-party identity provider (federation) in the IAM User Guide. If you use IAM Identity Center, you configure a permission set. To control what your identities can access after they authenticate, IAM Identity Center correlates the permission set to a role in IAM. For information about permissions sets, see Permission sets in the AWS IAM Identity Center User Guide. • Temporary IAM user permissions – An IAM user or role can assume an IAM role to temporarily take on different permissions for a specific task. • Cross-account access – You can use an IAM role to allow someone (a trusted principal) in a different account to access resources in your account. Roles are the primary way to grant cross- account access. However, with some AWS services, you can attach a policy directly to a resource (instead of using a role as a proxy). To learn the difference between roles and resource-based policies for cross-account access, see Cross account resource access in IAM in the IAM User Guide. • Cross-service access – Some AWS services use features in other AWS services. For example, when you make a call in a service, it's common for that service to run applications in Amazon EC2 or store objects in Amazon S3. A service might do this using the calling principal's permissions, using a service role, or using a service-linked role. • Forward access sessions (FAS) – When you use an IAM user or role to perform actions in AWS, you are considered a principal. When you use some services, you might perform an action that then initiates another action in a different service. FAS uses the permissions of the Authenticating with identities 840 AWS Step Functions Developer Guide principal calling an AWS service, combined with the requesting AWS service to make requests to downstream services. FAS requests are only made when a service receives a request that requires interactions with other AWS services or resources to complete. In this case, you must have permissions to perform both actions. For policy details when making FAS requests, see Forward access sessions. • Service role – A service role is an IAM role that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete a service role from within IAM. For more information, see Create a role to delegate permissions to an AWS service in the IAM User Guide. • Service-linked role – A service-linked role is a type of service role that is linked to an AWS service. The service can assume the role to perform an action on your behalf. Service-linked roles appear in your AWS account and are owned by the service. An IAM administrator can view, but not edit the permissions for service-linked roles. • Applications running on Amazon EC2 – You can use an IAM role to manage temporary credentials for applications that are running on an EC2 instance and making AWS CLI or AWS API requests. This is preferable to storing access keys within the EC2 instance. To assign an AWS role to an EC2 instance and make it available to all of its
|
step-functions-dg-225
|
step-functions-dg.pdf
| 225 |
service can assume the role to perform an action on your behalf. Service-linked roles appear in your AWS account and are owned by the service. An IAM administrator can view, but not edit the permissions for service-linked roles. • Applications running on Amazon EC2 – You can use an IAM role to manage temporary credentials for applications that are running on an EC2 instance and making AWS CLI or AWS API requests. This is preferable to storing access keys within the EC2 instance. To assign an AWS role to an EC2 instance and make it available to all of its applications, you create an instance profile that is attached to the instance. An instance profile contains the role and enables programs that are running on the EC2 instance to get temporary credentials. For more information, see Use an IAM role to grant permissions to applications running on Amazon EC2 instances in the IAM User Guide. Managing access using policies You control access in AWS by creating policies and attaching them to AWS identities or resources. A policy is an object in AWS that, when associated with an identity or resource, defines their permissions. AWS evaluates these policies when a principal (user, root user, or role session) makes a request. Permissions in the policies determine whether the request is allowed or denied. Most policies are stored in AWS as JSON documents. For more information about the structure and contents of JSON policy documents, see Overview of JSON policies in the IAM User Guide. Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. By default, users and roles have no permissions. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies. The administrator can then add the IAM policies to roles, and users can assume the roles. Managing access using policies 841 AWS Step Functions Developer Guide IAM policies define permissions for an action regardless of the method that you use to perform the operation. For example, suppose that you have a policy that allows the iam:GetRole action. A user with that policy can get role information from the AWS Management Console, the AWS CLI, or the AWS API. Identity-based policies Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Define custom IAM permissions with customer managed policies in the IAM User Guide. Identity-based policies can be further categorized as inline policies or managed policies. Inline policies are embedded directly into a single user, group, or role. Managed policies are standalone policies that you can attach to multiple users, groups, and roles in your AWS account. Managed policies include AWS managed policies and customer managed policies. To learn how to choose between a managed policy or an inline policy, see Choose between managed policies and inline policies in the IAM User Guide. Resource-based policies Resource-based policies are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM role trust policies and Amazon S3 bucket policies. In services that support resource-based policies, service administrators can use them to control access to a specific resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must specify a principal in a resource-based policy. Principals can include accounts, users, roles, federated users, or AWS services. Resource-based policies are inline policies that are located in that service. You can't use AWS managed policies from IAM in a resource-based policy. Access control lists (ACLs) Access control lists (ACLs) control which principals (account members, users, or roles) have permissions to access a resource. ACLs are similar to resource-based policies, although they do not use the JSON policy document format. Managing access using policies 842 AWS Step Functions Developer Guide Amazon S3, AWS WAF, and Amazon VPC are examples of services that support ACLs. To learn more about ACLs, see Access control list (ACL) overview in the Amazon Simple Storage Service Developer Guide. Other policy types AWS supports additional, less-common policy types. These policy types can set the maximum permissions granted to you by the more common policy types. • Permissions boundaries – A permissions boundary is an advanced feature in which you set the maximum permissions that an identity-based policy can grant to an IAM entity (IAM user or role). You can set a permissions boundary for an entity. The resulting permissions are the intersection of an entity's
|
step-functions-dg-226
|
step-functions-dg.pdf
| 226 |
of services that support ACLs. To learn more about ACLs, see Access control list (ACL) overview in the Amazon Simple Storage Service Developer Guide. Other policy types AWS supports additional, less-common policy types. These policy types can set the maximum permissions granted to you by the more common policy types. • Permissions boundaries – A permissions boundary is an advanced feature in which you set the maximum permissions that an identity-based policy can grant to an IAM entity (IAM user or role). You can set a permissions boundary for an entity. The resulting permissions are the intersection of an entity's identity-based policies and its permissions boundaries. Resource-based policies that specify the user or role in the Principal field are not limited by the permissions boundary. An explicit deny in any of these policies overrides the allow. For more information about permissions boundaries, see Permissions boundaries for IAM entities in the IAM User Guide. • Service control policies (SCPs) – SCPs are JSON policies that specify the maximum permissions for an organization or organizational unit (OU) in AWS Organizations. AWS Organizations is a service for grouping and centrally managing multiple AWS accounts that your business owns. If you enable all features in an organization, then you can apply service control policies (SCPs) to any or all of your accounts. The SCP limits permissions for entities in member accounts, including each AWS account root user. For more information about Organizations and SCPs, see Service control policies in the AWS Organizations User Guide. • Resource control policies (RCPs) – RCPs are JSON policies that you can use to set the maximum available permissions for resources in your accounts without updating the IAM policies attached to each resource that you own. The RCP limits permissions for resources in member accounts and can impact the effective permissions for identities, including the AWS account root user, regardless of whether they belong to your organization. For more information about Organizations and RCPs, including a list of AWS services that support RCPs, see Resource control policies (RCPs) in the AWS Organizations User Guide. • Session policies – Session policies are advanced policies that you pass as a parameter when you programmatically create a temporary session for a role or federated user. The resulting session's permissions are the intersection of the user or role's identity-based policies and the session policies. Permissions can also come from a resource-based policy. An explicit deny in any of these policies overrides the allow. For more information, see Session policies in the IAM User Guide. Managing access using policies 843 AWS Step Functions Multiple policy types Developer Guide When multiple types of policies apply to a request, the resulting permissions are more complicated to understand. To learn how AWS determines whether to allow a request when multiple policy types are involved, see Policy evaluation logic in the IAM User Guide. Access Control You can have valid credentials to authenticate your requests, but unless you have permissions you cannot create or access Step Functions resources. For example, you must have permissions to invoke AWS Lambda, Amazon Simple Notification Service (Amazon SNS), and Amazon Simple Queue Service (Amazon SQS) targets associated with your Step Functions rules. The following sections describe how to manage permissions for Step Functions. • Creating an IAM role for your state machine in Step Functions • Creating granular permissions for non-admin users in Step Functions • Creating Amazon VPC endpoints for Step Functions • How Step Functions generates IAM policies for integrated services • IAM policies for using Distributed Map states How AWS Step Functions works with IAM Before you use IAM to manage access to Step Functions, learn what IAM features are available to use with Step Functions. The following table lists IAM features that you can use with AWS Step Functions: IAM feature Step Functions support Identity-based policies Resource-based policies Policy actions Policy resources Policy condition keys (service-specific) Yes No Yes Yes Yes Access Control 844 AWS Step Functions IAM feature ACLs ABAC (tags in policies) Temporary credentials Principal permissions Service roles Service-linked roles Step Functions support Developer Guide No Partial Yes Yes Yes No To get a high-level view of how Step Functions and other AWS services work with most IAM features, see AWS services that work with IAM in the IAM User Guide. Identity-based policies for Step Functions Supports identity-based policies: Yes Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Define custom IAM permissions with customer managed policies in the IAM User Guide. With IAM identity-based policies, you can specify allowed or denied actions and resources
|
step-functions-dg-227
|
step-functions-dg.pdf
| 227 |
most IAM features, see AWS services that work with IAM in the IAM User Guide. Identity-based policies for Step Functions Supports identity-based policies: Yes Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see Define custom IAM permissions with customer managed policies in the IAM User Guide. With IAM identity-based policies, you can specify allowed or denied actions and resources as well as the conditions under which actions are allowed or denied. You can't specify the principal in an identity-based policy because it applies to the user or role to which it is attached. To learn about all of the elements that you can use in a JSON policy, see IAM JSON policy elements reference in the IAM User Guide. Identity-based policy examples for Step Functions To view examples of Step Functions identity-based policies, see Identity-based policy examples for AWS Step Functions. Resource-based policies within Step Functions Supports resource-based policies: No How AWS Step Functions works with IAM 845 AWS Step Functions Developer Guide Resource-based policies are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM role trust policies and Amazon S3 bucket policies. In services that support resource-based policies, service administrators can use them to control access to a specific resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must specify a principal in a resource-based policy. Principals can include accounts, users, roles, federated users, or AWS services. To enable cross-account access, you can specify an entire account or IAM entities in another account as the principal in a resource-based policy. Adding a cross-account principal to a resource- based policy is only half of establishing the trust relationship. When the principal and the resource are in different AWS accounts, an IAM administrator in the trusted account must also grant the principal entity (user or role) permission to access the resource. They grant permission by attaching an identity-based policy to the entity. However, if a resource-based policy grants access to a principal in the same account, no additional identity-based policy is required. For more information, see Cross account resource access in IAM in the IAM User Guide. Policy actions for Step Functions Supports policy actions: Yes Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. The Action element of a JSON policy describes the actions that you can use to allow or deny access in a policy. Policy actions usually have the same name as the associated AWS API operation. There are some exceptions, such as permission-only actions that don't have a matching API operation. There are also some operations that require multiple actions in a policy. These additional actions are called dependent actions. Include actions in a policy to grant permissions to perform the associated operation. To see a list of Step Functions actions, see Resources Defined by AWS Step Functions in the Service Authorization Reference. Policy actions in Step Functions use the following prefix before the action: states To specify multiple actions in a single statement, separate them with commas. How AWS Step Functions works with IAM 846 AWS Step Functions Developer Guide "Action": [ "states:action1", "states:action2" ] To view examples of Step Functions identity-based policies, see Identity-based policy examples for AWS Step Functions. Policy resources for Step Functions Supports policy resources: Yes Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. The Resource JSON policy element specifies the object or objects to which the action applies. Statements must include either a Resource or a NotResource element. As a best practice, specify a resource using its Amazon Resource Name (ARN). You can do this for actions that support a specific resource type, known as resource-level permissions. For actions that don't support resource-level permissions, such as listing operations, use a wildcard (*) to indicate that the statement applies to all resources. "Resource": "*" To see a list of Step Functions resource types and their ARNs, see Actions Defined by AWS Step Functions in the Service Authorization Reference. To learn with which actions you can specify the ARN of each resource, see Resources Defined by AWS Step Functions. To view examples of Step Functions identity-based policies, see Identity-based policy examples for AWS Step Functions. Policy condition keys for Step Functions Supports service-specific policy condition keys: Yes Administrators can use AWS
|
step-functions-dg-228
|
step-functions-dg.pdf
| 228 |
that don't support resource-level permissions, such as listing operations, use a wildcard (*) to indicate that the statement applies to all resources. "Resource": "*" To see a list of Step Functions resource types and their ARNs, see Actions Defined by AWS Step Functions in the Service Authorization Reference. To learn with which actions you can specify the ARN of each resource, see Resources Defined by AWS Step Functions. To view examples of Step Functions identity-based policies, see Identity-based policy examples for AWS Step Functions. Policy condition keys for Step Functions Supports service-specific policy condition keys: Yes Administrators can use AWS JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions. The Condition element (or Condition block) lets you specify conditions in which a statement is in effect. The Condition element is optional. You can create conditional expressions that use How AWS Step Functions works with IAM 847 AWS Step Functions Developer Guide condition operators, such as equals or less than, to match the condition in the policy with values in the request. If you specify multiple Condition elements in a statement, or multiple keys in a single Condition element, AWS evaluates them using a logical AND operation. If you specify multiple values for a single condition key, AWS evaluates the condition using a logical OR operation. All of the conditions must be met before the statement's permissions are granted. You can also use placeholder variables when you specify conditions. For example, you can grant an IAM user permission to access a resource only if it is tagged with their IAM user name. For more information, see IAM policy elements: variables and tags in the IAM User Guide. AWS supports global condition keys and service-specific condition keys. To see all AWS global condition keys, see AWS global condition context keys in the IAM User Guide. To see a list of Step Functions condition keys, see Condition Keys for AWS Step Functions in the Service Authorization Reference. To learn with which actions and resources you can use a condition key, see Resources Defined by AWS Step Functions. If your policy must depend on the Step Functions service principal name, we recommend you check for the existence or non-existence of states.amazonaws.com in the aws:PrincipalServiceNamesList multivalued context key, rather than the aws:PrincipalServiceName condition key. The aws:PrincipalServiceName condition key contains only one entry from the list of service principal names and it may not always be states.amazonaws.com. The following condition block demonstrates checking for the existence of states.amazonaws.com. { "Condition": { "ForAnyValue:StringEquals": { "aws:PrincipalServiceNamesList": "states.amazonaws.com" } } } To view examples of Step Functions identity-based policies, see Identity-based policy examples for AWS Step Functions. ACLs in Step Functions Supports ACLs: No How AWS Step Functions works with IAM 848 AWS Step Functions Developer Guide Access control lists (ACLs) control which principals (account members, users, or roles) have permissions to access a resource. ACLs are similar to resource-based policies, although they do not use the JSON policy document format. ABAC with Step Functions Supports ABAC (tags in policies): Partial Attribute-based access control (ABAC) is an authorization strategy that defines permissions based on attributes. In AWS, these attributes are called tags. You can attach tags to IAM entities (users or roles) and to many AWS resources. Tagging entities and resources is the first step of ABAC. Then you design ABAC policies to allow operations when the principal's tag matches the tag on the resource that they are trying to access. ABAC is helpful in environments that are growing rapidly and helps with situations where policy management becomes cumbersome. To control access based on tags, you provide tag information in the condition element of a policy using the aws:ResourceTag/key-name, aws:RequestTag/key-name, or aws:TagKeys condition keys. If a service supports all three condition keys for every resource type, then the value is Yes for the service. If a service supports all three condition keys for only some resource types, then the value is Partial. For more information about ABAC, see Define permissions with ABAC authorization in the IAM User Guide. To view a tutorial with steps for setting up ABAC, see Use attribute-based access control (ABAC) in the IAM User Guide. Using temporary credentials with Step Functions Supports temporary credentials: Yes Some AWS services don't work when you sign in using temporary credentials. For additional information, including which AWS services work with temporary credentials, see AWS services that work with IAM in the IAM User Guide. You are using temporary credentials if you sign in to the AWS Management Console using any method except a user name and password. For example, when you access AWS using your How AWS Step Functions works with IAM 849 AWS Step Functions Developer Guide company's single sign-on (SSO) link, that process
|
step-functions-dg-229
|
step-functions-dg.pdf
| 229 |
the IAM User Guide. Using temporary credentials with Step Functions Supports temporary credentials: Yes Some AWS services don't work when you sign in using temporary credentials. For additional information, including which AWS services work with temporary credentials, see AWS services that work with IAM in the IAM User Guide. You are using temporary credentials if you sign in to the AWS Management Console using any method except a user name and password. For example, when you access AWS using your How AWS Step Functions works with IAM 849 AWS Step Functions Developer Guide company's single sign-on (SSO) link, that process automatically creates temporary credentials. You also automatically create temporary credentials when you sign in to the console as a user and then switch roles. For more information about switching roles, see Switch from a user to an IAM role (console) in the IAM User Guide. You can manually create temporary credentials using the AWS CLI or AWS API. You can then use those temporary credentials to access AWS. AWS recommends that you dynamically generate temporary credentials instead of using long-term access keys. For more information, see Temporary security credentials in IAM. Cross-service principal permissions for Step Functions Supports forward access sessions (FAS): Yes When you use an IAM user or role to perform actions in AWS, you are considered a principal. When you use some services, you might perform an action that then initiates another action in a different service. FAS uses the permissions of the principal calling an AWS service, combined with the requesting AWS service to make requests to downstream services. FAS requests are only made when a service receives a request that requires interactions with other AWS services or resources to complete. In this case, you must have permissions to perform both actions. For policy details when making FAS requests, see Forward access sessions. Service roles for Step Functions Supports service roles: Yes A service role is an IAM role that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete a service role from within IAM. For more information, see Create a role to delegate permissions to an AWS service in the IAM User Guide. Warning Changing the permissions for a service role might break Step Functions functionality. Edit service roles only when Step Functions provides guidance to do so. Service-linked roles for Step Functions Supports service-linked roles: No How AWS Step Functions works with IAM 850 AWS Step Functions Developer Guide A service-linked role is a type of service role that is linked to an AWS service. The service can assume the role to perform an action on your behalf. Service-linked roles appear in your AWS account and are owned by the service. An IAM administrator can view, but not edit the permissions for service-linked roles. For details about creating or managing service-linked roles, see AWS services that work with IAM. Find a service in the table that includes a Yes in the Service-linked role column. Choose the Yes link to view the service-linked role documentation for that service. Identity-based policy examples for AWS Step Functions By default, users and roles don't have permission to create or modify Step Functions resources. They also can't perform tasks by using the AWS Management Console, AWS Command Line Interface (AWS CLI), or AWS API. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies. The administrator can then add the IAM policies to roles, and users can assume the roles. To learn how to create an IAM identity-based policy by using these example JSON policy documents, see Create IAM policies (console) in the IAM User Guide. For details about actions and resource types defined by Step Functions, including the format of the ARNs for each of the resource types, see Actions, Resources, and Condition Keys for AWS Step Functions in the Service Authorization Reference. Topics • Policy best practices • Using the Step Functions console • Allow users to view their own permissions Policy best practices Identity-based policies determine whether someone can create, access, or delete Step Functions resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations: • Get started with AWS managed policies and move toward least-privilege permissions – To get started granting permissions to your users and workloads, use the AWS managed policies that grant permissions for many common use cases. They are available in your AWS account. We Identity-based policy examples 851 AWS Step Functions Developer Guide recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see AWS managed policies or AWS managed policies for job functions in the
|
step-functions-dg-230
|
step-functions-dg.pdf
| 230 |
When you create or edit identity-based policies, follow these guidelines and recommendations: • Get started with AWS managed policies and move toward least-privilege permissions – To get started granting permissions to your users and workloads, use the AWS managed policies that grant permissions for many common use cases. They are available in your AWS account. We Identity-based policy examples 851 AWS Step Functions Developer Guide recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see AWS managed policies or AWS managed policies for job functions in the IAM User Guide. • Apply least-privilege permissions – When you set permissions with IAM policies, grant only the permissions required to perform a task. You do this by defining the actions that can be taken on specific resources under specific conditions, also known as least-privilege permissions. For more information about using IAM to apply permissions, see Policies and permissions in IAM in the IAM User Guide. • Use conditions in IAM policies to further restrict access – You can add a condition to your policies to limit access to actions and resources. For example, you can write a policy condition to specify that all requests must be sent using SSL. You can also use conditions to grant access to service actions if they are used through a specific AWS service, such as AWS CloudFormation. For more information, see IAM JSON policy elements: Condition in the IAM User Guide. • Use IAM Access Analyzer to validate your IAM policies to ensure secure and functional permissions – IAM Access Analyzer validates new and existing policies so that the policies adhere to the IAM policy language (JSON) and IAM best practices. IAM Access Analyzer provides more than 100 policy checks and actionable recommendations to help you author secure and functional policies. For more information, see Validate policies with IAM Access Analyzer in the IAM User Guide. • Require multi-factor authentication (MFA) – If you have a scenario that requires IAM users or a root user in your AWS account, turn on MFA for additional security. To require MFA when API operations are called, add MFA conditions to your policies. For more information, see Secure API access with MFA in the IAM User Guide. For more information about best practices in IAM, see Security best practices in IAM in the IAM User Guide. Using the Step Functions console To access the AWS Step Functions console, you must have a minimum set of permissions. These permissions must allow you to list and view details about the Step Functions resources in your AWS account. If you create an identity-based policy that is more restrictive than the minimum required permissions, the console won't function as intended for entities (users or roles) with that policy. You don't need to allow minimum console permissions for users that are making calls only to the AWS CLI or the AWS API. Instead, allow access to only the actions that match the API operation that they're trying to perform. Identity-based policy examples 852 AWS Step Functions Developer Guide To ensure that users and roles can still use the Step Functions console, also attach the Step Functions ConsoleAccess or ReadOnly AWS managed policy to the entities. For more information, see Adding permissions to a user in the IAM User Guide. Allow users to view their own permissions This example shows how you might create a policy that allows IAM users to view the inline and managed policies that are attached to their user identity. This policy includes permissions to complete this action on the console or programmatically using the AWS CLI or AWS API. { "Version": "2012-10-17", "Statement": [ { "Sid": "ViewOwnUserInfo", "Effect": "Allow", "Action": [ "iam:GetUserPolicy", "iam:ListGroupsForUser", "iam:ListAttachedUserPolicies", "iam:ListUserPolicies", "iam:GetUser" ], "Resource": ["arn:aws:iam::*:user/${aws:username}"] }, { "Sid": "NavigateInConsole", "Effect": "Allow", "Action": [ "iam:GetGroupPolicy", "iam:GetPolicyVersion", "iam:GetPolicy", "iam:ListAttachedGroupPolicies", "iam:ListGroupPolicies", "iam:ListPolicyVersions", "iam:ListPolicies", "iam:ListUsers" ], "Resource": "*" } ] } Identity-based policy examples 853 AWS Step Functions Developer Guide AWS managed policies for AWS Step Functions An AWS managed policy is a standalone policy that is created and administered by AWS. AWS managed policies are designed to provide permissions for many common use cases so that you can start assigning permissions to users, groups, and roles. Keep in mind that AWS managed policies might not grant least-privilege permissions for your specific use cases because they're available for all AWS customers to use. We recommend that you reduce permissions further by defining customer managed policies that are specific to your use cases. You cannot change the permissions defined in AWS managed policies. If AWS updates the permissions defined in an AWS managed policy, the update affects all principal identities (users, groups, and roles) that the policy is attached to. AWS is most likely to update an AWS managed
|
step-functions-dg-231
|
step-functions-dg.pdf
| 231 |
can start assigning permissions to users, groups, and roles. Keep in mind that AWS managed policies might not grant least-privilege permissions for your specific use cases because they're available for all AWS customers to use. We recommend that you reduce permissions further by defining customer managed policies that are specific to your use cases. You cannot change the permissions defined in AWS managed policies. If AWS updates the permissions defined in an AWS managed policy, the update affects all principal identities (users, groups, and roles) that the policy is attached to. AWS is most likely to update an AWS managed policy when a new AWS service is launched or new API operations become available for existing services. For more information, see AWS managed policies in the IAM User Guide. AWS managed policy: AWSStepFunctionsConsoleFullAccess You can attach the AWSStepFunctionsConsoleFullAccess policy to your IAM identities. This policy grants administratorpermissions that allow a user access to use the Step Functions console. For a full console experience, a user may also need iam:PassRole permission on other IAM roles that can be assumed by the service. AWS managed policy: AWSStepFunctionsReadOnlyAccess You can attach the AWSStepFunctionsReadOnlyAccess policy to your IAM identities. This policy grants read-only permissions that allow a user or role to list and describe state machines, activities, executions, activities, tags, MapRuns, and state machine alias and versions. This policy also grants permission to check the syntax of state machine definitions that you provide. AWS managed policies 854 AWS Step Functions Developer Guide AWS managed policy: AWSStepFunctionsFullAccess You can attach the AWSStepFunctionsFullAccess policy to your IAM identities. This policy grants full permissions to a user or role to use the Step Functions API. For full access, a user must have iam:PassRole permission on at least one IAM role that can be assumed by the service. Step Functions updates to AWS managed policies View details about updates to AWS managed policies for Step Functions since this service began tracking these changes. For automatic alerts about changes to this page, subscribe to the RSS feed on the Step Functions Document history page. Change Description Date AWSStepFunctionsRe adOnlyAccess – Update to an Step Functions added new permissions to allow calling existing policy states:ValidateSta April 25, 2024 teMachineDefinition API action to check the syntax of state machine definitions that you provide. AWSStepFunctionsRe adOnlyAccess – Update to an Step Functions added new permissions to allow listing April 02, 2024 existing policy and reading data related to: Tags (ListTagsForResource), Distributed Map (ListMapR uns, DescribeMapRun), Versions and Aliases (Describe StateMachineAlias, ListState MachineAliases, ListState MachineVersions). Step Functions started tracking changes Step Functions started tracking changes for its AWS April 02, 2024 managed policies. AWS managed policies 855 AWS Step Functions Developer Guide Creating an IAM role for your state machine in Step Functions AWS Step Functions can execute code and access AWS resources (such as invoking an AWS Lambda function). To maintain security, you must grant Step Functions access to those resources by using an IAM role. The Tutorials for learning Step Functions in this guide enable you to take advantage of automatically generated IAM roles that are valid for the AWS Region in which you create the state machine. However, you can create your own IAM role for a state machine. When creating an IAM policy for your state machines to use, the policy should include the permissions that you would like the state machines to assume. You can use an existing AWS managed policy as an example or you can create a custom policy from scratch that meets your specific needs. For more information, see Creating IAM policies in the IAM User Guide To create your own IAM role for a state machine, follow the steps in this section. In this example, you create an IAM role with permission to invoke a Lambda function. Create a role for Step Functions 1. Sign in to the IAM console, and then choose Roles, Create role. 2. On the Select trusted entity page, under AWS service, select Step Functions from the list, and then choose Next: Permissions. 3. On the Attached permissions policy page, choose Next: Review. 4. On the Review page, enter StepFunctionsLambdaRole for Role Name, and then choose Create role. The IAM role appears in the list of roles. For more information about IAM permissions and policies, see Access Management in the IAM User Guide. Prevent cross-service confused deputy issue The confused deputy problem is a security issue where an entity that doesn't have permission to perform an action can coerce a more-privileged entity to perform the action. In AWS, cross- service impersonation can result in the confused deputy problem. Cross-service impersonation can occur when one service (the calling service) calls another service (the called service). This type of Creating a state machine IAM role 856 AWS Step Functions Developer Guide impersonation
|
step-functions-dg-232
|
step-functions-dg.pdf
| 232 |
role appears in the list of roles. For more information about IAM permissions and policies, see Access Management in the IAM User Guide. Prevent cross-service confused deputy issue The confused deputy problem is a security issue where an entity that doesn't have permission to perform an action can coerce a more-privileged entity to perform the action. In AWS, cross- service impersonation can result in the confused deputy problem. Cross-service impersonation can occur when one service (the calling service) calls another service (the called service). This type of Creating a state machine IAM role 856 AWS Step Functions Developer Guide impersonation can happen cross-account and cross-service. The calling service can be manipulated to use its permissions to act on another customer's resources in a way it should not otherwise have permission to access. To prevent confused deputies, AWS provides tools that help you protect your data for all services with service principals that have been given access to resources in your account. This section focuses on cross-service confused deputy prevention specific to AWS Step Functions; however, you can learn more about this topic in the confused deputy problem section of the IAM User Guide. We recommend using the aws:SourceArn and aws:SourceAccount global condition context keys in resource policies to limit the permissions that Step Functions gives another service to access your resources. Use aws:SourceArn if you want only one resource to be associated with the cross- service access. Use aws:SourceAccount if you want to allow any resource in that account to be associated with the cross-service use. The most effective way to protect against the confused deputy problem is to use the aws:SourceArn global condition context key with the full ARN of the resource. If you don’t know the full ARN of the resource, or if you're specifying multiple resources, use the aws:SourceArn global context condition key with wildcard characters (*) for the unknown portions of the ARN. For example, arn:aws:states:*:111122223333:*. Here's an example of a trusted policy that shows how you can use aws:SourceArn and aws:SourceAccount with Step Functions to prevent the confused deputy issue. { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Principal":{ "Service":[ "states.amazonaws.com" ] }, "Action":"sts:AssumeRole", "Condition":{ "ArnLike":{ "aws:SourceArn":"arn:aws:states:region:111122223333:stateMachine:*" }, "StringEquals":{ "aws:SourceAccount":"111122223333" Creating a state machine IAM role 857 AWS Step Functions } } } ] } Attach an Inline Policy Developer Guide Step Functions can control other services directly in a Task state. Attach inline policies to allow Step Functions to access the API actions of the services you need to control. 1. Open the IAM console, choose Roles, search for your Step Functions role, and select that role. 2. Select Add inline policy. 3. Use the Visual editor or the JSON tab to create policies for your role. For more information about how AWS Step Functions can control other AWS services, see Integrating services with Step Functions. Note For examples of IAM policies created by the Step Functions console, see How Step Functions generates IAM policies for integrated services. Creating granular permissions for non-admin users in Step Functions The default managed policies in IAM, such as ReadOnly, don't fully cover all types of AWS Step Functions permissions. This section describes these different types of permissions and provides some example configurations. Step Functions has four categories of permissions. Depending on what access you want to provide to a user, you can control access by using permissions in these categories. Service-Level Permissions Apply to components of the API that do not act on a specific resource. State Machine-Level Permissions Apply to all API components that act on a specific state machine. Creating granular permissions for non-admin users 858 AWS Step Functions Execution-Level Permissions Developer Guide Apply to all API components that act on a specific execution. Activity-Level Permissions Apply to all API components that act on a specific activity or on a particular instance of an activity. Service-Level Permissions This permission level applies to all API actions that do not act on a specific resource. These include CreateStateMachine, CreateActivity, ListStateMachines, ListActivities, and ValidateStateMachineDefinition. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:ListStateMachines", "states:ListActivities", "states:CreateStateMachine", "states:CreateActivity", "states:ValidateStateMachineDefinition", ], "Resource": [ "arn:aws:states:*:*:*" ] }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam:::role/my-execution-role" ] } ] } Creating granular permissions for non-admin users 859 AWS Step Functions Developer Guide State Machine-Level Permissions This permission level applies to all API actions that act on a specific state machine. These API operations require the Amazon Resource Name (ARN) of the state machine as part of the request, such as DeleteStateMachine, DescribeStateMachine, StartExecution, and ListExecutions. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:DescribeStateMachine", "states:StartExecution", "states:DeleteStateMachine", "states:ListExecutions", "states:UpdateStateMachine", "states:TestState", "states:RevealSecrets" ], "Resource": [ "arn:aws:states:*:*:stateMachine:StateMachinePrefix*" ] } ] } Execution-Level Permissions This permission level applies to all the API actions that act on a specific execution. These API operations require the
|
step-functions-dg-233
|
step-functions-dg.pdf
| 233 |
permissions for non-admin users 859 AWS Step Functions Developer Guide State Machine-Level Permissions This permission level applies to all API actions that act on a specific state machine. These API operations require the Amazon Resource Name (ARN) of the state machine as part of the request, such as DeleteStateMachine, DescribeStateMachine, StartExecution, and ListExecutions. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:DescribeStateMachine", "states:StartExecution", "states:DeleteStateMachine", "states:ListExecutions", "states:UpdateStateMachine", "states:TestState", "states:RevealSecrets" ], "Resource": [ "arn:aws:states:*:*:stateMachine:StateMachinePrefix*" ] } ] } Execution-Level Permissions This permission level applies to all the API actions that act on a specific execution. These API operations require the ARN of the execution as part of the request, such as DescribeExecution, GetExecutionHistory, and StopExecution. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:DescribeExecution", Creating granular permissions for non-admin users 860 AWS Step Functions Developer Guide "states:DescribeStateMachineForExecution", "states:GetExecutionHistory", "states:StopExecution" ], "Resource": [ "arn:aws:states:*:*:execution:*:ExecutionPrefix*" ] } ] } Activity-Level Permissions This permission level applies to all the API actions that act on a specific activity or on a particular instance of it. These API operations require the ARN of the activity or the token of the instance as part of the request, such as DeleteActivity, DescribeActivity, GetActivityTask, and SendTaskHeartbeat. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:DescribeActivity", "states:DeleteActivity", "states:GetActivityTask", "states:SendTaskHeartbeat" ], "Resource": [ "arn:aws:states:*:*:activity:ActivityPrefix*" ] } ] } Accessing resources in other AWS accounts in Step Functions Step Functions provides cross-account access to resources configured in different AWS accounts in your workflows. Using Step Functions service integrations, you can invoke any cross-account AWS resource even if that AWS service does not support resource-based policies or cross-account calls. Accessing cross-account AWS resources 861 AWS Step Functions Developer Guide For example, assume you own two AWS accounts, called Development and Testing, in the same AWS Region. Using cross-account access, your workflow in the Development account can access resources, such as Amazon S3 buckets, Amazon DynamoDB tables, and Lambda functions that are available in the Testing account. Important IAM roles and resource-based policies delegate access across accounts only within a single partition. For example, assume that you have an account in US West (N. California) in the standard aws partition. You also have an account in China (Beijing) in the aws-cn partition. You can't use an Amazon S3 resource-based policy in your account in China (Beijing) to allow access for users in your standard aws account. For more information about cross-account access, see Cross-account policy evaluation logic in the IAM User Guide. Although each AWS account maintains complete control over its own resources, with Step Functions, you can reorganize, swap, add, or remove steps in your workflows without the need to customize any code. You can do this even as the processes change or applications evolve. You can also invoke executions of nested state machines so they're available across different accounts. Doing so efficiently separates and isolates your workflows. When you use the .sync service integration pattern in your workflows that access another Step Functions workflow in a different account, Step Functions uses polling that consumes your assigned quota. For more information, see Run a Job (.sync). Note Currently, cross-Region AWS SDK integration and cross-Region AWS resource access aren't available in Step Functions. Key cross-account resource concepts Execution role An IAM role that Step Functions uses to run code and access AWS resources, such as the AWS Lambda function's Invoke action. Accessing cross-account AWS resources 862 AWS Step Functions Service integration Developer Guide The AWS SDK integration API actions that can be called from within a Task state in your workflows. source account An AWS account that owns the state machine and has started its execution. target account An AWS account to which you make cross-account calls. target role An IAM role in the target account that the state machine assumes for making calls to resources that the target account owns. Run a Job (.sync) A service integration pattern used to call services, such as AWS Batch. It also makes a Step Functions state machine wait for a job to complete before progressing to the next state. To indicate that Step Functions should wait, append the .sync suffix in the Resource field in your Task state definition. Invoking cross-account resources To invoke a cross-account resource in your workflows, do the following: 1. Create an IAM role in the target account that contains the resource. This role grants the source account, containing the state machine, permissions to access the target account's resources. 2. In the Task state's definition, specify the target IAM role to be assumed by the state machine before invoking the cross-account resource. 3. Modify the trust policy in the target IAM role to allow the source account to assume this role temporarily. The trust policy must include the Amazon Resource Name (ARN) of the state machine defined
|
step-functions-dg-234
|
step-functions-dg.pdf
| 234 |
resources To invoke a cross-account resource in your workflows, do the following: 1. Create an IAM role in the target account that contains the resource. This role grants the source account, containing the state machine, permissions to access the target account's resources. 2. In the Task state's definition, specify the target IAM role to be assumed by the state machine before invoking the cross-account resource. 3. Modify the trust policy in the target IAM role to allow the source account to assume this role temporarily. The trust policy must include the Amazon Resource Name (ARN) of the state machine defined in the source account. Also, define the appropriate permissions in the target IAM role to call the AWS resource. 4. Update the source account’s execution role to include the required permission for assuming the target IAM role. For an example, see Accessing cross-account AWS resources in Step Functions in the tutorials. Accessing cross-account AWS resources 863 AWS Step Functions Note Developer Guide You can configure your state machine to assume an IAM role for accessing resources from multiple AWS accounts. However, a state machine can assume only one IAM role at a given time. Cross-account access for .sync integration pattern When you use the .sync service integration patterns in your workflows, Step Functions polls the invoked cross-account resource to confirm the task is complete. This causes a slight delay between the actual task completion time and the time when Step Functions recognizes the task as complete. The target IAM role needs the required permissions for a .sync invocation to complete this polling loop. To do this, the target IAM role must have a trust policy that allows the source account to assume it. Additionally, the target IAM role needs the required permissions to complete the polling loop. Accessing cross-account AWS resources 864 AWS Step Functions Note Developer Guide For nested Express Workflows, arn:aws:states:::states:startExecution.sync isn't currently supported. Use arn:aws:states:::aws- sdk:sfn:startSyncExecution instead. Trust policy update for .sync calls Update the trust policy of your target IAM role as shown in the following example. The sts:ExternalId field further controls who can assume the role. The state machine's name must include only characters that the AWS Security Token Service AssumeRole API supports. For more information, see AssumeRole in the AWS Security Token Service API Reference. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "sts:AssumeRole", "Principal": { "AWS": "arn:aws:iam::sourceAccountID:role/InvokeRole", }, "Condition": { "StringEquals": { "sts:ExternalId": "arn:aws:states:us- east-2:sourceAccountID:stateMachine:stateMachineName" } } } ] } Permissions required for .sync calls To grant the permissions required for your state machine, update the required permissions for the target IAM role. For more information, see the section called “IAM Policies for integrated services”. The Amazon EventBridge permissions from the example policies aren't required. For example, to start a state machine, add the following permissions. { Accessing cross-account AWS resources 865 AWS Step Functions Developer Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:StartExecution" ], "Resource": [ "arn:aws:states:region:account-id:stateMachine:stateMachineName" ] }, { "Effect": "Allow", "Action": [ "states:DescribeExecution", "states:StopExecution" ], "Resource": [ "arn:aws:states:region:account-id:execution:stateMachineName:*" ] } ] } Creating Amazon VPC endpoints for Step Functions If you use Amazon Virtual Private Cloud (Amazon VPC) to host your AWS resources, you can establish a connection between your Amazon VPC and AWS Step Functions workflows. You can use this connection with your Step Functions workflows without crossing the public internet. Amazon VPC endpoints are supported by Standard Workflows, Express Workflows, and Synchronous Express Workflows. Amazon VPC lets you launch AWS resources in a custom virtual network. You can use a VPC to control your network settings, such as the IP address range, subnets, route tables, and network gateways. For more information about VPCs, see the Amazon VPC User Guide. To connect your Amazon VPC to Step Functions, you must first define an interface VPC endpoint, which lets you connect your VPC to other AWS services. The endpoint provides reliable, scalable connectivity, without requiring an internet gateway, network address translation (NAT) instance, or VPN connection. For more information, see Interface VPC Endpoints (AWS PrivateLink) in the Amazon VPC User Guide. Create VPC endpoints 866 AWS Step Functions Creating the Endpoint Developer Guide You can create an AWS Step Functions endpoint in your VPC using the AWS Management Console, the AWS Command Line Interface (AWS CLI), an AWS SDK, the AWS Step Functions API, or AWS CloudFormation. For information about creating and configuring an endpoint using the Amazon VPC console or the AWS CLI, see Creating an Interface Endpoint in the Amazon VPC User Guide. Note When you create an endpoint, specify Step Functions as the service that you want your VPC to connect to. In the Amazon VPC console, service names vary based on the AWS Region. For example, if you choose US East (N. Virginia), the service name for Standard Workflows and Express Workflows
|
step-functions-dg-235
|
step-functions-dg.pdf
| 235 |
AWS Management Console, the AWS Command Line Interface (AWS CLI), an AWS SDK, the AWS Step Functions API, or AWS CloudFormation. For information about creating and configuring an endpoint using the Amazon VPC console or the AWS CLI, see Creating an Interface Endpoint in the Amazon VPC User Guide. Note When you create an endpoint, specify Step Functions as the service that you want your VPC to connect to. In the Amazon VPC console, service names vary based on the AWS Region. For example, if you choose US East (N. Virginia), the service name for Standard Workflows and Express Workflows is com.amazonaws.us-east-1.states, and the service name for Synchronous Express Workflows is com.amazonaws.us-east-1.sync-states. Note It's possible to use VPC Endpoints without overriding the endpoint in the SDK through Private DNS. However, if you want to override the endpoint in the SDK for Synchronous Express Workflows, you need to set DisableHostPrefixInjection configuration to true. Example (Java SDK V2): SfnClient.builder() .endpointOverride(URI.create("https://vpce-{vpceId}.sync-states.us- east-1.vpce.amazonaws.com")) .overrideConfiguration(ClientOverrideConfiguration.builder() .advancedOptions(ImmutableMap.of(SdkAdvancedClientOption.DISABLE_HOST_PREFIX_INJECTION, true)) .build()) .build(); For information about creating and configuring an endpoint using AWS CloudFormation, see the AWS::EC2::VPCEndpoint resource in the AWS CloudFormation User Guide. Create VPC endpoints 867 AWS Step Functions Developer Guide Amazon VPC Endpoint Policies To control connectivity access to Step Functions you can attach an AWS Identity and Access Management (IAM) endpoint policy while creating an Amazon VPC endpoint. You can create complex IAM rules by attaching multiple endpoint policies. For more information, see: • Amazon Virtual Private Cloud Endpoint Policies for Step Functions • Creating granular permissions for non-admin users in Step Functions • Controlling Access to Services with VPC Endpoints Amazon Virtual Private Cloud Endpoint Policies for Step Functions You can create an Amazon VPC endpoint policy for Step Functions in which you specify the following: • The principal that can perform actions. • The actions that can be performed. • The resources on which the actions can be performed. The following example shows an Amazon VPC endpoint policy that allows one user to create state machines, and denies all other users permission to delete state machines. The example policy also grants all users execution permission. { "Version": "2012-10-17", "Statement": [ { "Action": "*Execution", "Resource": "*", "Effect": "Allow", "Principal": "*" }, { "Action": "states:CreateStateMachine", "Resource": "*", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::account-id:user/MyUser" } Create VPC endpoints 868 Developer Guide AWS Step Functions }, { "Action": "states:DeleteStateMachine", "Resource": "*", "Effect": "Deny", "Principal": "*" } ] } For more information about creating endpoint policies, see the following: • Creating granular permissions for non-admin users in Step Functions • Controlling Access to Services with VPC Endpoints How Step Functions generates IAM policies for integrated services When you create a state machine in the AWS Step Functions console, Step Functions produces an AWS Identity and Access Management (IAM) policy based on the resources used in your state machine definition, as follows: • For optimized integrations, Step Functions will create a policy with all the necessary permissions and roles for your state machine. Tip: You can see example policies in each of the service pages under Integrating optimized services. • For standard integrations integrations, Step Functions will create an IAM role with partial permissions. You must add any missing role policies that your state machine needs to interact with the service. Dynamic and static resources Static resources are defined directly in the task state of your state machine. When you include the information about the resources you want to call directly in your task states, Step Functions can create an IAM role for only those resources. IAM Policies for integrated services 869 AWS Step Functions Developer Guide Dynamic resources are passed as input when starting your state machine, or as input to an individual state, and accessed using JSONata or a JSONPath. When you are passing dynamic resources to your task, Step Functions cannot automatically scope-down the permissions, so Step Functions will create a more permissive policy which specifies:"Resource": "*". Additional permissions for tasks using .sync Tasks that use the Run a Job (.sync) pattern require additional permissions for monitoring and receiving a response from the API of connected services. Step Functions uses two approaches to monitor a job's status when a job is run on a connected service: polling and events. Polling requires permission for Describe or Get API actions. For example, for Amazon ECS the state machine must have allow permission for ecs:DescribeTasks, for AWS Glue the state machine requires allow permissions for glue:GetJobRun. If the necessary permissions are missing from the role, Step Functions may be unable to determine the status of your job. One reason for using the polling method is because some service integrations do not support EventBridge events, and some services only send events on a best-effort basis. Alternatively, you might use events sent from AWS services to Amazon EventBridge. Events are routed
|
step-functions-dg-236
|
step-functions-dg.pdf
| 236 |
polling and events. Polling requires permission for Describe or Get API actions. For example, for Amazon ECS the state machine must have allow permission for ecs:DescribeTasks, for AWS Glue the state machine requires allow permissions for glue:GetJobRun. If the necessary permissions are missing from the role, Step Functions may be unable to determine the status of your job. One reason for using the polling method is because some service integrations do not support EventBridge events, and some services only send events on a best-effort basis. Alternatively, you might use events sent from AWS services to Amazon EventBridge. Events are routed to Step Functions by EventBridge with a managed rule, so the role requires permissions for events:PutTargets, events:PutRule, and events:DescribeRule. If these permissions are missing from the role, there may be a delay before Step Functions becomes aware of the completion of your job. For more information about EventBridge events, see Events from AWS services. Troubleshooting stuck .sync workflows For Run a Job (.sync) tasks that support both polling and events, your task may complete properly using events, even when the role lacks the required permissions for polling. In the previous scenario, you might not notice the polling permissions are missing or incorrect. In the rare case that an event fails to be delivered to or processed by Step Functions, your execution could become stuck. To verify that your polling permissions are configured correctly, you can run an execution in an environment without EventBridge events in the following ways • Delete the managed rule in EventBridge that is responsible for forwarding events to Step Functions. IAM Policies for integrated services 870 AWS Step Functions Note Developer Guide Because managed rules are shared by all state machines in your account, you should use a test or development account to avoid unintentional impact to other state machines. • You can identify the specific managed rule to delete by inspecting the Resource field used for events:PutRule in the policy template for the target service. The managed rule will be recreated the next time you create or update a state machine that uses that service integration. • For more information on deleting EventBridge rules, see Disabling or deleting a rule. Permissions for cancelling workflows If a task that uses the Run a Job (.sync) pattern is stopped, Step Functions will make a best-effort attempt to cancel the task. Cancelling a task requires permission to Cancel, Stop, Terminate, or Delete API actions, such as batch:TerminateJob or eks:DeleteCluster. If these permissions are missing from your role, Step Functions will be unable to cancel your task and you may accrue additional charges while it continues to run. For more information on stopping tasks, see Run a Job. Learn more about integration patterns To learn about synchronous tasks, see Discover service integration patterns in Step Functions. IAM policies for Activities-only Step Functions state machines For a state machine that has only Activity tasks, or no tasks at all, use an IAM policy that denies access to all actions and resources. { "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "*", "Resource": "*" Activities or no task workflows 871 AWS Step Functions } ] } Developer Guide For more information about using Activity tasks, see Learn about Activities in Step Functions. IAM policies for using Distributed Map states When you create workflows with the Step Functions console, Step Functions can automatically generate IAM policies based on the resources in your workflow definition. These policies include the least privileges necessary to allow the state machine role to invoke the StartExecution API action for the Distributed Map state. These policies also include the least privileges necessary Step Functions to access AWS resources, such as Amazon S3 buckets and objects and Lambda functions. We highly recommend that you include only those permissions that are necessary in your IAM policies. For example, if your workflow includes a Map state in Distributed mode, scope your policies down to the specific Amazon S3 bucket and folder that contains your dataset. Important If you specify an Amazon S3 bucket and object, or prefix, with a reference path to an existing key-value pair in your Distributed Map state input, make sure that you update the IAM policies for your workflow. Scope the policies down to the bucket and object names the path resolves to at runtime. Example of IAM policy for running a Distributed Map state When you include a Distributed Map state in your workflows, Step Functions needs appropriate permissions to allow the state machine role to invoke the StartExecution API action for the Distributed Map state. The following IAM policy example grants the least privileges required to your state machine role for running the Distributed Map state. Note Make sure that you replace stateMachineName with the name of the state machine in which you're using the
|
step-functions-dg-237
|
step-functions-dg.pdf
| 237 |
your workflow. Scope the policies down to the bucket and object names the path resolves to at runtime. Example of IAM policy for running a Distributed Map state When you include a Distributed Map state in your workflows, Step Functions needs appropriate permissions to allow the state machine role to invoke the StartExecution API action for the Distributed Map state. The following IAM policy example grants the least privileges required to your state machine role for running the Distributed Map state. Note Make sure that you replace stateMachineName with the name of the state machine in which you're using the Distributed Map state. For example, arn:aws:states:region:account-id:stateMachine:mystateMachine. IAM policies for Distributed Maps 872 AWS Step Functions Developer Guide { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:StartExecution" ], "Resource": [ "arn:aws:states:region:account-id:stateMachine:stateMachineName" ] }, { "Effect": "Allow", "Action": [ "states:DescribeExecution" ], "Resource": "arn:aws:states:region:account-id:execution:stateMachineName:*" } ] } Example of IAM policy for redriving a Distributed Map You can restart unsuccessful child workflow executions in a Map Run by redriving your parent workflow. A redriven parent workflow redrives all the unsuccessful states, including Distributed Map. Make sure that your execution role has the least privileges necessary to allow it to invoke the RedriveExecution API action on the parent workflow. The following IAM policy example grants the least privileges required to your state machine role for redriving a Distributed Map state. Note Make sure that you replace stateMachineName with the name of the state machine in which you're using the Distributed Map state. For example, arn:aws:states:region:account-id:stateMachine:mystateMachine. { IAM policies for Distributed Maps 873 AWS Step Functions Developer Guide "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:RedriveExecution" ], "Resource": "arn:aws:states:us-east-2:account- id:execution:stateMachineName/myMapRunLabel:*" } ] } Examples of IAM policies for reading data from Amazon S3 datasets The following IAM policy examples grant the least privileges required to access your Amazon S3 datasets using the ListObjectsV2 and GetObject API actions. Example IAM policy for Amazon S3 object as dataset The following example shows an IAM policy that grants the least privileges to access the objects organized within processImages in an Amazon S3 bucket named amzn-s3-demo-bucket. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::amzn-s3-demo-bucket" ], "Condition": { "StringLike": { "s3:prefix": [ "processImages" ] } } } ] IAM policies for Distributed Maps 874 AWS Step Functions } Example IAM policy for a CSV file as dataset Developer Guide The following example shows an IAM policy that grants least privileges to access a CSV file named ratings.csv. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::amzn-s3-demo-bucket/csvDataset/ratings.csv" ] } ] } Example IAM policy for an Amazon S3 inventory as dataset The following example shows an IAM policy that grants least privileges to access an Amazon S3 inventory report. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::destination-prefix/amzn-s3-demo-bucket/config-id/YYYY-MM- DDTHH-MMZ/manifest.json", "arn:aws:s3:::destination-prefix/amzn-s3-demo-bucket/config-id/data/*" ] } ] IAM policies for Distributed Maps 875 AWS Step Functions } Developer Guide Example of IAM policy for writing data to an Amazon S3 bucket The following IAM policy example grants the least privileges required to write your child workflow execution results to a folder named csvJobs in an Amazon S3 bucket using the PutObject API action. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload" ], "Resource": [ "arn:aws:s3:::amzn-s3-demo-destination-bucket/csvJobs/*" ] } ] } IAM permissions for AWS KMS key encrypted Amazon S3 bucket Distributed Map state uses multipart uploads to write the child workflow execution results to an Amazon S3 bucket. If the bucket is encrypted using an AWS Key Management Service (AWS KMS) key, you must also include permissions in your IAM policy to perform the kms:Decrypt, kms:Encrypt, and kms:GenerateDataKey actions on the key. These permissions are required because Amazon S3 must decrypt and read data from the encrypted file parts before it completes the multipart upload. The following IAM policy example grants permission to the kms:Decrypt, kms:Encrypt, and kms:GenerateDataKey actions on the key used to encrypt your Amazon S3 bucket. { "Version": "2012-10-17", "Statement": { IAM policies for Distributed Maps 876 AWS Step Functions Developer Guide "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:Encrypt", "kms:GenerateDataKey" ], "Resource": [ "arn:aws:kms:region:account-id:key/111aa2bb-333c-4d44-5555-a111bb2c33dd" ] } } For more information, see Uploading a large file to Amazon S3 with encryption using an AWS KMS key in the AWS Knowledge Center. If your IAM user or role is in the same AWS account as the KMS key, then you must have these permissions on the key policy. If your IAM user or role belongs to a different account than the KMS key, then you must have the permissions on both the key policy and your IAM user or role. Creating tag-based IAM policies in Step Functions Step Functions supports policies based on tags. For example, you
|
step-functions-dg-238
|
step-functions-dg.pdf
| 238 |
} } For more information, see Uploading a large file to Amazon S3 with encryption using an AWS KMS key in the AWS Knowledge Center. If your IAM user or role is in the same AWS account as the KMS key, then you must have these permissions on the key policy. If your IAM user or role belongs to a different account than the KMS key, then you must have the permissions on both the key policy and your IAM user or role. Creating tag-based IAM policies in Step Functions Step Functions supports policies based on tags. For example, you could restrict access to all Step Functions resources that include a tag with the key environment and the value production. { "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": [ "states:TagResource", "states:UntagResource", "states:DeleteActivity", "states:DeleteStateMachine", "states:StopExecution" ], "Resource": "*", "Condition": { "StringEquals": {"aws:ResourceTag/environment": "production"} } } ] Creating tag-based policies 877 AWS Step Functions } Developer Guide This policy will Deny the ability to delete state machines or activities, stop executions, and add or delete new tags for all resources that have been tagged as environment/production. For tag-based authorization, state machine execution resources as shown in the following example inherit the tags associated with a state machine. arn:partition:states:region:account-id:execution:<StateMachineName>:<ExecutionId> When you call DescribeExecution or other APIs in which you specify the execution resource ARN, Step Functions uses tags associated with the state machine to accept or deny the request while performing tag-based authorization. This helps you allow or deny access to state machine executions at the state machine level. For more information about tagging, see the following: • Tagging state machines and activities in Step Functions • Controlling Access Using IAM Tags Troubleshooting identity and access issues in Step Functions Use the following information to help you diagnose and fix common issues that you might encounter when working with Step Functions and IAM. Topics • I am not authorized to perform an action in Step Functions • I am not authorized to perform iam:PassRole • I want to allow people outside of my AWS account to access my Step Functions resources I am not authorized to perform an action in Step Functions If you receive an error that you're not authorized to perform an action, your policies must be updated to allow you to perform the action. The following example error occurs when the mateojackson user tries to use the console to view details about a fictional my-example-widget resource but does not have the fictional states:GetWidget permissions. Troubleshooting identity and access 878 AWS Step Functions Developer Guide User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: states:GetWidget on resource: my-example-widget In this case, Mateo's policy must be updated to allow him to access the my-example-widget resource using the states:GetWidget action. If you need help, contact your AWS administrator. Your administrator is the person who provided you with your sign-in credentials. I am not authorized to perform iam:PassRole If you receive an error that you're not authorized to perform the iam:PassRole action, your policies must be updated to allow you to pass a role to Step Functions. Some AWS services allow you to pass an existing role to that service instead of creating a new service role or service-linked role. To do this, you must have permissions to pass the role to the service. The following example error occurs when an IAM user named marymajor tries to use the console to perform an action in Step Functions. However, the action requires the service to have permissions that are granted by a service role. Mary does not have permissions to pass the role to the service. User: arn:aws:iam::123456789012:user/marymajor is not authorized to perform: iam:PassRole In this case, Mary's policies must be updated to allow her to perform the iam:PassRole action. If you need help, contact your AWS administrator. Your administrator is the person who provided you with your sign-in credentials. I want to allow people outside of my AWS account to access my Step Functions resources You can create a role that users in other accounts or people outside of your organization can use to access your resources. You can specify who is trusted to assume the role. For services that support resource-based policies or access control lists (ACLs), you can use those policies to grant people access to your resources. To learn more, consult the following: Troubleshooting identity and access 879 AWS Step Functions Developer Guide • To learn whether Step Functions supports these features, see How AWS Step Functions works with IAM. • To learn how to provide access to your resources across AWS accounts that you own, see Providing access to an IAM user in another AWS account that you own in the IAM User Guide. • To learn how to provide access to your resources to third-party AWS accounts, see Providing access
|
step-functions-dg-239
|
step-functions-dg.pdf
| 239 |
control lists (ACLs), you can use those policies to grant people access to your resources. To learn more, consult the following: Troubleshooting identity and access 879 AWS Step Functions Developer Guide • To learn whether Step Functions supports these features, see How AWS Step Functions works with IAM. • To learn how to provide access to your resources across AWS accounts that you own, see Providing access to an IAM user in another AWS account that you own in the IAM User Guide. • To learn how to provide access to your resources to third-party AWS accounts, see Providing access to AWS accounts owned by third parties in the IAM User Guide. • To learn how to provide access through identity federation, see Providing access to externally authenticated users (identity federation) in the IAM User Guide. • To learn the difference between using roles and resource-based policies for cross-account access, see Cross account resource access in IAM in the IAM User Guide. Compliance validation for Step Functions Third-party auditors assess the security and compliance of AWS Step Functions as part of multiple AWS compliance programs. These include SOC, PCI, FedRAMP, HIPAA, and others. For a list of AWS services in scope of specific compliance programs, see AWS Services in Scope by Compliance Program. For general information, see AWS Compliance Programs. You can download third-party audit reports using AWS Artifact. For more information, see Downloading Reports in AWS Artifact. Your compliance responsibility when using Step Functions is determined by the sensitivity of your data, your company's compliance objectives, and applicable laws and regulations. AWS provides the following resources to help with compliance: • Security and Compliance Quick Start Guides – These deployment guides discuss architectural considerations and provide steps for deploying security- and compliance-focused baseline environments on AWS. • Architecting for HIPAA Security and Compliance on Amazon Web Services – This whitepaper describes how companies can use AWS to create HIPAA-compliant applications. • AWS Compliance Resources – This collection of workbooks and guides might apply to your industry and location. • Evaluating Resources with Rules in the AWS Config Developer Guide – The AWS Config service assesses how well your resource configurations comply with internal practices, industry guidelines, and regulations. Compliance validation 880 AWS Step Functions Developer Guide • AWS Security Hub – This AWS service provides a comprehensive view of your security state within AWS that helps you check your compliance with security industry standards and best practices. Resilience in Step Functions The AWS global infrastructure is built around AWS Regions and Availability Zones. AWS Regions provide multiple physically separated and isolated Availability Zones, which are connected with low-latency, high-throughput, and highly redundant networking. With Availability Zones, you can design and operate applications and databases that automatically fail over between zones without interruption. Availability Zones are more highly available, fault tolerant, and scalable than traditional single or multiple data center infrastructures. For more information about AWS Regions and Availability Zones, see AWS Global Infrastructure. In addition to the AWS global infrastructure, Step Functions offers several features to help support your data resiliency and backup needs. Infrastructure security in Step Functions As a managed service, AWS Step Functions is protected by AWS global network security. For information about AWS security services and how AWS protects infrastructure, see AWS Cloud Security. To design your AWS environment using the best practices for infrastructure security, see Infrastructure Protection in Security Pillar AWS Well‐Architected Framework. You use AWS published API calls to access Step Functions through the network. Clients must support the following: • Transport Layer Security (TLS). We require TLS 1.2 and recommend TLS 1.3. • Cipher suites with perfect forward secrecy (PFS) such as DHE (Ephemeral Diffie-Hellman) or ECDHE (Elliptic Curve Ephemeral Diffie-Hellman). Most modern systems such as Java 7 and later support these modes. Additionally, requests must be signed by using an access key ID and a secret access key that is associated with an IAM principal. Or you can use the AWS Security Token Service (AWS STS) to generate temporary security credentials to sign requests. You can call the AWS API operations from any network location, but Step Functions doesn't support resource-based access policies, which can include restrictions based on the source IP Resilience 881 AWS Step Functions Developer Guide address. You can also use Step Functions policies to control access from specific Amazon Virtual Private Cloud (Amazon VPC) endpoints or specific VPCs. Effectively, this isolates network access to a given Step Functions resource from only the specific VPC within the AWS network. Infrastructure security 882 AWS Step Functions Developer Guide Logging and monitoring AWS Step Functions service performance Learn how to log and monitor Step Functions to maintain the reliability, availability, and performance of Step Functions and your AWS solutions. There are several tools available to use with Step Functions:
|
step-functions-dg-240
|
step-functions-dg.pdf
| 240 |
source IP Resilience 881 AWS Step Functions Developer Guide address. You can also use Step Functions policies to control access from specific Amazon Virtual Private Cloud (Amazon VPC) endpoints or specific VPCs. Effectively, this isolates network access to a given Step Functions resource from only the specific VPC within the AWS network. Infrastructure security 882 AWS Step Functions Developer Guide Logging and monitoring AWS Step Functions service performance Learn how to log and monitor Step Functions to maintain the reliability, availability, and performance of Step Functions and your AWS solutions. There are several tools available to use with Step Functions: Topics • Monitoring Step Functions metrics using Amazon CloudWatch • Automating Step Functions event delivery with EventBridge • Recording Step Functions API calls with AWS CloudTrail • Using CloudWatch Logs to log execution history in Step Functions • Trace Step Functions request data in AWS X-Ray • Setting up Step Functions event notification using AWS User Notifications Tip To deploy a sample workflow and learn how to monitor metrics, logs, and traces of the workflow execution, see Adding observability in The AWS Step Functions Workshop. Monitoring Step Functions metrics using Amazon CloudWatch Monitoring is an important part of maintaining the reliability, availability, and performance of AWS Step Functions and your AWS solutions. You should collect as much monitoring data from the AWS services that you use so that you can debug multi-point failures. Before you start monitoring Step Functions, you should create a monitoring plan that answers the following questions: • What are your monitoring goals? • What resources will you monitor? • How often will you monitor these resources? Metrics in CloudWatch 883 AWS Step Functions Developer Guide • What monitoring tools will you use? • Who will perform the monitoring tasks? • Who should be notified when something goes wrong? The next step is to establish a baseline for normal performance in your environment. To do this, measure performance at various times and under different load conditions. As you monitor Step Functions, consider storing historical monitoring data. Such data can give you a baseline to compare against current performance data, to identify normal performance patterns and performance anomalies, and to devise ways to address issues. For example, with Step Functions, you can monitor how many activities or AWS Lambda tasks fail due to a heartbeat timeout. When performance falls outside your established baseline, you might have to change your heartbeat interval. To establish a baseline you should, at a minimum, monitor the following metrics: • ActivitiesStarted • ActivitiesTimedOut • ExecutionsStarted • ExecutionsTimedOut • LambdaFunctionsStarted • LambdaFunctionsTimedOut Step Functions metrics for CloudWatch Step Functions provides the following types of metrics to Amazon CloudWatch. You can use these metrics to track your state machines and activities and to set alarms on threshold values. You can view metrics using the AWS Management Console. CloudWatch metrics delivery CloudWatch metrics are delivered on a best-effort basis. The completeness and timeliness of metrics are not guaranteed. The data point for a particular request might be returned with a timestamp that is later than when the request was actually processed. The data point for a minute might be delayed before being available through CloudWatch metrics 884 AWS Step Functions Developer Guide CloudWatch, or it might not be delivered at all. CloudWatch request metrics give you an idea of the state machine executions in near-real time. It is not meant to be a complete accounting of all execution-related metrics. It follows from the best-effort nature of this feature that the reports available at the Billing & Cost Management Dashboard might include one or more access requests that do not appear in the execution metrics. Metrics that report a time interval Some of the Step Functions CloudWatch metrics are time intervals, always measured in milliseconds. These metrics generally correspond to stages of your execution for which you can set state machine, activity, and Lambda function timeouts, with descriptive names. For example, the ActivityRunTime metric measures the time it takes for an activity to complete after it begins to execute. You can set a timeout value for the same time period. In the CloudWatch console, you can get the best results if you choose average as the display statistic for time interval metrics. Metrics that report a count Some of the Step Functions CloudWatch metrics report results as a count. For example, ExecutionsFailed records the number of failed state machine executions. Step Functions emits two ExecutionsStarted metrics for every state machine execution. This causes the SampleCount statistic for the ExecutionsStarted metric to show the value of 2 for every state machine execution. The SampleCount statistic shows ExecutionStarted=1 and ExecutionStarted=0 when the execution completes. Tip We recommend selecting Sum as the display statistic for metrics that report a count in the CloudWatch console. Execution metrics The AWS/States namespace includes
|
step-functions-dg-241
|
step-functions-dg.pdf
| 241 |
statistic for time interval metrics. Metrics that report a count Some of the Step Functions CloudWatch metrics report results as a count. For example, ExecutionsFailed records the number of failed state machine executions. Step Functions emits two ExecutionsStarted metrics for every state machine execution. This causes the SampleCount statistic for the ExecutionsStarted metric to show the value of 2 for every state machine execution. The SampleCount statistic shows ExecutionStarted=1 and ExecutionStarted=0 when the execution completes. Tip We recommend selecting Sum as the display statistic for metrics that report a count in the CloudWatch console. Execution metrics The AWS/States namespace includes the following metrics for all Step Functions executions. These are dimensionless metrics that apply across your account in a region. CloudWatch metrics 885 AWS Step Functions Developer Guide Metric Description OpenExecutionCount Approximate number of currently open executions—workflows that are currently in progress in your account. The intent is to provide insight into when your workflows are approaching the maximum execution limit, to avoid Execution LimitExceeded errors when calling StartExecution or RedriveExecution for Standard Workflows. OpenExecutionCount workflows. This metric will be lower than observed running is an approximate number of open workflow count. Running open workflow count lower than 10,000 may show zero open executions. For an alarm to notify if you are nearing your OpenExecutionLimit recommend using the Maximum statistic with a threshold , we of 100K or higher since the default open workflow limit is 1,000,000 executions. OpenExecutionLimit Maximum number of open executions. For more information, see Quotas related to accounts. This limit does not apply to Express Workflows. Execution metrics for state machine with version or alias When you run a state machine execution with a version or an alias, Step Functions emits the following metrics. The ExecutionThrottled metric will only be emitted in the case of throttled execution. These metrics will include a StateMachineArn to identify a specific state machine. Metric Description ExecutionTime Interval, in milliseconds, between the time the execution starts and the time it closes. CloudWatch metrics 886 AWS Step Functions Developer Guide Metric Description ExecutionThrottled Number of StateEntered events and retries that have been throttled. This is related to StateTransition throttling. For more information, see Quotas related to state throttling. ExecutionsAborted Number of aborted or terminated executions. ExecutionsFailed Number of failed executions. ExecutionsStarted Number of started executions. ExecutionsSucceeded Number of successfully completed executions. ExecutionsTimedOut Number of executions that time out for any reason. Execution metrics for Express Workflows The AWS/States namespace includes the following metrics for Step Functions Express Workflows' executions. Metric Description ExpressExecutionMe The total memory consumed by an Express Workflow. mory ExpressExecutionBi The duration for which an Express Workflow is charged. lledDuration ExpressExecutionBi lledMemory The amount of consumed memory for which an Express Workflow is charged. Redrive execution metrics for Standard Workflows When you redrive a state machine execution, Step Functions emits the following metrics. For all redriven executions, the Executions* metric is emitted. For example, say a redriven execution aborts. This execution will emit non-zero datapoints for both RedrivenExecutionsAborted and ExecutionsAborted. CloudWatch metrics 887 AWS Step Functions Developer Guide Metric Description ExecutionsRedriven Number of redriven executions. RedrivenExecutions Aborted Number of redriven executions that are canceled or terminate d. RedrivenExecutions Number of redriven executions that time out for any reason. TimedOut RedrivenExecutions Number of redriven executions that completed successfully. Succeeded RedrivenExecutions Number of redriven executions that failed. Failed Dimension for Step Functions execution metrics Dimension Description StateMachineArn The Amazon Resource Name (ARN) of the state machine for the execution in question. Dimensions for executions with version Dimension Description StateMachineArn The Amazon Resource Name (ARN) of the state machine whose execution was started by a version. Version State machine version used to start the execution. CloudWatch metrics 888 AWS Step Functions Developer Guide Dimensions for executions with an alias Dimension Description StateMachineArn The Amazon Resource Name (ARN) of the state machine whose execution was started by an alias. Alias State machine alias used to start the execution. Resource count metrics for versions and aliases The AWS/States namespace includes the following metrics for the count of versions and aliases of a state machine. Metric AliasCount Description Number of aliases created for the state machine. You can create up to 100 aliases for each state machine. VersionCount Number of versions published for the state machine. You can publish up to 1000 versions of a state machine. Dimension for resource count metrics for versions and aliases Dimension Description ResourceArn The Amazon Resource Name (ARN) of the state machine with a version or an alias. Activity Metrics The AWS/States namespace includes the following metrics for Step Functions activities. CloudWatch metrics 889 AWS Step Functions Developer Guide Metric Description ActivityRunTime Interval, in milliseconds, between the time the activity starts and the time it closes. ActivityScheduleTime Interval, in milliseconds, for which the activity stays in the schedule state. ActivityTime
|
step-functions-dg-242
|
step-functions-dg.pdf
| 242 |
machine. VersionCount Number of versions published for the state machine. You can publish up to 1000 versions of a state machine. Dimension for resource count metrics for versions and aliases Dimension Description ResourceArn The Amazon Resource Name (ARN) of the state machine with a version or an alias. Activity Metrics The AWS/States namespace includes the following metrics for Step Functions activities. CloudWatch metrics 889 AWS Step Functions Developer Guide Metric Description ActivityRunTime Interval, in milliseconds, between the time the activity starts and the time it closes. ActivityScheduleTime Interval, in milliseconds, for which the activity stays in the schedule state. ActivityTime Interval, in milliseconds, between the time the activity is scheduled and the time it closes. ActivitiesFailed Number of failed activities. ActivitiesHeartbea Number of activities that time out due to a heartbeat timeout. tTimedOut ActivitiesScheduled Number of scheduled activities. ActivitiesStarted Number of started activities. ActivitiesSucceeded Number of successfully completed activities. ActivitiesTimedOut Number of activities that time out on close. Dimension for Step Functions Activity Metrics Dimension Description ActivityArn The ARN of the activity. Lambda Function Metrics The AWS/States namespace includes the following metrics for Step Functions Lambda functions. CloudWatch metrics 890 AWS Step Functions Developer Guide Metric Description LambdaFunctionRunT ime Interval, in milliseconds, between the time the Lambda function starts and the time it closes. LambdaFunctionSche duleTime Interval, in milliseconds, for which the Lambda function stays in the schedule state. LambdaFunctionTime Interval, in milliseconds, between the time the Lambda function is scheduled and the time it closes. LambdaFunctionsFai Number of failed Lambda functions. led LambdaFunctionsSch Number of scheduled Lambda functions. eduled LambdaFunctionsSta Number of started Lambda functions. rted LambdaFunctionsSuc Number of successfully completed Lambda functions. ceeded LambdaFunctionsTim Number of Lambda functions that time out on close. edOut Dimension for Step Functions Lambda Function Metrics Dimension Description LambdaFunctionArn The ARN of the Lambda function. Note Lambda Function Metrics are emitted for Task states that specify the Lambda function ARN in the Resource field. Task states that use "Resource": CloudWatch metrics 891 AWS Step Functions Developer Guide "arn:aws:states:::lambda:invoke" emit Service Integration Metrics instead. For more information, see Invoke an AWS Lambda function with Step Functions. Service Integration Metrics The AWS/States namespace includes the following metrics for Step Functions service integrations. For more information, see Integrating services with Step Functions. Metric Description ServiceIntegration RunTime Interval, in milliseconds, between the time the Service Task starts and the time it closes. ServiceIntegration ScheduleTime Interval, in milliseconds, for which the Service Task stays in the schedule state. ServiceIntegration Time Interval, in milliseconds, between the time the Service Task is scheduled and the time it closes. ServiceIntegration Number of failed Service Tasks. sFailed ServiceIntegration Number of scheduled Service Tasks. sScheduled ServiceIntegration Number of started Service Tasks. sStarted ServiceIntegration Number of successfully completed Service Tasks. sSucceeded ServiceIntegration Number of Service Tasks that time out on close. sTimedOut CloudWatch metrics 892 AWS Step Functions Developer Guide Dimension for Step Functions Service Integration Metrics Dimension Description ServiceIntegration The resource ARN of the integrated service. ResourceArn Service Metrics The AWS/States namespace includes the following metrics for the Step Functions service. Metric Description ThrottledEvents Count of requests that have been throttled. ProvisionedBucketS Count of available requests per second. ize ProvisionedRefillR Count of requests per second that are allowed into the bucket. ate ConsumedCapacity Count of requests per second. Dimension for Step Functions Service Metrics Dimension Description ServiceMetric Filters data to show State Transitions metrics. API Metrics The AWS/States namespace includes the following metrics for the Step Functions API. Metric Description ThrottledEvents Count of requests that have been throttled. CloudWatch metrics 893 AWS Step Functions Developer Guide Metric Description ProvisionedBucketS Count of available requests per second. ize ProvisionedRefillR Count of requests per second that are allowed into the bucket. ate ConsumedCapacity Count of requests per second. Dimension for Step Functions API Metrics Dimension APIName Description Filters data to an API of the specified API name. Viewing Step Functions metrics in CloudWatch You can use the CloudWatch console to view Step Functions metrics for executions, activities, functions, and service integrations. 1. Sign in to the AWS Management Console and open the CloudWatch console. 2. Choose Metrics, and on the All Metrics tab, choose States. If you ran any executions recently, you will see up to four types of metrics: • Execution Metrics • Activity Function Metrics • Lambda Function Metrics • Service Integration Metrics 3. Choose a metric type to see a list of metrics. • To sort your metrics by Metric Name or StateMachineArn, use the column headings. • To view graphs for a metric, choose the box next to the metric on the list. You can change the graph parameters using the time range controls above the graph view. Viewing metrics in CloudWatch 894 AWS Step Functions Developer Guide You can choose custom time ranges using relative or absolute values (specific days and
|
step-functions-dg-243
|
step-functions-dg.pdf
| 243 |
four types of metrics: • Execution Metrics • Activity Function Metrics • Lambda Function Metrics • Service Integration Metrics 3. Choose a metric type to see a list of metrics. • To sort your metrics by Metric Name or StateMachineArn, use the column headings. • To view graphs for a metric, choose the box next to the metric on the list. You can change the graph parameters using the time range controls above the graph view. Viewing metrics in CloudWatch 894 AWS Step Functions Developer Guide You can choose custom time ranges using relative or absolute values (specific days and times). You can also use the dropdown list to display values as lines, stacked areas, or numbers (values). • To view the details about a graph, hover over the metric color code that appears below the graph to display the metric details. For more information about working with CloudWatch metrics, see Using Amazon CloudWatch Metrics in the Amazon CloudWatch User Guide. Setting alarms for Step Functions metrics in CloudWatch You can use Amazon CloudWatch alarms to perform actions. For example, if you want to know when an alarm threshold is reached, you can set an alarm to send a notification to an Amazon SNS topic or to send an email when the StateMachinesFailed metric rises above a certain threshold. To set an alarm on a metric 1. Sign in to the AWS Management Console and open the CloudWatch console. 2. Choose Metrics, and on the All Metrics tab, choose States. If you ran any executions recently, you will see up to four types of metrics: • Execution Metrics • Activity Function Metrics • Lambda Function Metrics • Service Integration Metrics 3. Choose a metric type to see a list of metrics. 4. Choose a metric, and then choose Graphed metrics. 5. Choose the bell-shaped icon next to a metric on the list to display the Create Alarm page. 6. Enter the values for the Alarm threshold and Actions, and then choose Create Alarm. For more information about setting and using CloudWatch alarms, see Creating Amazon CloudWatch Alarms in the Amazon CloudWatch User Guide. Setting alarms in CloudWatch 895 AWS Step Functions Developer Guide Automating Step Functions event delivery with EventBridge With EventBridge, you can select events from Step Functions standard workflows, to send to other services for additional processing. This technique provides a flexible way to loosely connect components and monitor your resources. Amazon EventBridge is a serverless service that connects application components together to build scalable event-driven applications. Event-driven architecture is a style of building loosely-coupled software systems that work together by emitting and responding to events. Events represent a change in state, or an update. By using EventBridge to deliver Step Functions events to other services, you can monitor your standard workflows without continuously calling the DescribeExecution API to get the status. Status changes in state machine executions are sent to EventBridge automatically. You can use those events to target services. For example, events might invoke a AWS Lambda function, publish a message to Amazon Simple Notification Service (Amazon SNS) topic, or even run another SFN workflow. How event delivery works Step Functions generates and sends events to the default EventBridge event bus which is automatically provisioned in every AWS account. An event bus is a router that receives events and delivers them to zero or more destinations, or targets. Targets are other AWS services. You can specify rules for the event bus that compare events against the rule's event pattern. When the event matches a pattern, the event bus sends the event to the specified target(s). The following diagram shows this process: Automate event delivery 896 AWS Step Functions Developer Guide Standard versus Express workflows Only standard workflows emit events to EventBridge. To monitor the execution of express workflows, you can use CloudWatch Logs. See Logging in CloudWatch Logs. Step Functions events Step Functions sends the following events to the default EventBridge event bus automatically. Events that match a rule's event pattern are delivered to the specified targets on a best-effort basis. Events might be delivered out of order. For more information, see EventBridge events in the Amazon EventBridge User Guide. Event detail type Description Execution Status Change Represents a change in the status of a state machine execution. Delivering Step Functions events using EventBridge To have the EventBridge default event bus send Step Functions events to a target, you must create a rule. Each rule contains an event pattern, which EventBridge matches against each event received on the event bus. If the event data matches the specified event pattern, EventBridge delivers that event to the rule's target(s). For comprehensive instructions on creating event bus rules, see Creating rules that react to events in the EventBridge User Guide. You can also create an event bus rule for
|
step-functions-dg-244
|
step-functions-dg.pdf
| 244 |
Change Represents a change in the status of a state machine execution. Delivering Step Functions events using EventBridge To have the EventBridge default event bus send Step Functions events to a target, you must create a rule. Each rule contains an event pattern, which EventBridge matches against each event received on the event bus. If the event data matches the specified event pattern, EventBridge delivers that event to the rule's target(s). For comprehensive instructions on creating event bus rules, see Creating rules that react to events in the EventBridge User Guide. You can also create an event bus rule for a specific state machine from the Step Functions console: • On the Details page of a state machine, choose Actions, and then choose Create EventBridge rule. The EventBridge console opens to the Create rule page, with the state machine selected as the event source for the rule. • Follow the procedure detailed in Creating rules that react to events in the EventBridge User Guide. Step Functions events 897 AWS Step Functions Developer Guide Creating event patterns that match Step Functions events Each event pattern is a JSON object that contains: • A source attribute that identifies the service sending the event. For Step Functions events, the source is aws.states. • (Optional): A detail-type attribute that contains an array of the event types to match. • (Optional): A detail attribute containing any other event data on which to match. For example, the following event pattern matches against all Execution Status Change events from Step Functions: { "source": ["aws.states"], "detail-type": ["Step Functions Execution Status Change"] } While the following example matches against a specific execution associated with a specific state machine, when that execution fails or times out: { "source": ["aws.states"], "detail-type": ["Step Functions Execution Status Change"], "detail": { "status": ["FAILED", "TIMED_OUT"], "stateMachineArn": ["arn:aws:states:region:account-id:stateMachine:state-machine"], "executionArn": ["arn:aws:states:region:account-id:execution:state-machine- name:execution-name"] } } For more information on writing event patterns, see Event patterns in the EventBridge User Guide. Triggering Step Functions state machines using events You can also specify a Step Functions state machine as a target for EventBridge event bus rule. This enables you to trigger an execution of a Step Functions workflow in response to an event from another AWS service. For more information, see Amazon EventBridge targets in the Amazon EventBridge User Guide. Triggering Step Functions state machines 898 AWS Step Functions Developer Guide Step Functions events detail reference All events from AWS services have a common set of fields containing metadata about the event, such as the AWS service that is the source of the event, the time the event was generated, the account and region in which the event took place, and others. For definitions of these general fields, see Event structure reference in the Amazon EventBridge User Guide. In addition, each event has a detail field that contains data specific to that particular event. When using EventBridge to select and manage Step Functions events, it's useful to keep the following in mind: • The source field for all events from Step Functions is set to aws.states. • The detail-type field specifies the event type. For example, Step Functions Execution Status Change. • The detail field contains the data that is specific to that particular event. For information on constructing event patterns that enable rules to match Step Functions events, see Event patterns in the Amazon EventBridge User Guide. For more information on events and how EventBridge processes them, see Amazon EventBridge events in the Amazon EventBridge User Guide. Execution Status Change Represents a change in the status of a state machine execution. The source and detail-type fields are included below because they contain specific values for Step Functions events. For definitions of the other metadata fields that are included in all events, see Event structure reference in the Amazon EventBridge User Guide. Event structure { . . ., "detail-type": "Step Functions Execution Status Change", "source"": "aws.states", . . ., "detail"": { "executionArn"" : "string", Events detail reference 899 AWS Step Functions Developer Guide "input" : "string", "inputDetails" : { "included" : "boolean" }, "name" : "string", "output" : "string", "outputDetails" : { "included" : "boolean" }, "startDate" : "integer", "stateMachineArn" : "string", "stopDate" : "integer", "status" : "RUNNING | SUCCEEDED | FAILED | TIMED_OUT | ABORTED | PENDING_REDRIVE" } } Remarks An Execution Status Change event can contain an input property in its definition. For some events, an Execution Status Change event can also contain an output property in its definition. • If the combined escaped input and escaped output sent to EventBridge exceeds 248 KiB, then the input will be excluded. Similarly, if the escaped output exceeds 248 KiB, then the output will be excluded. This is a result of events quotas. • You can determine whether a payload has been truncated with the inputDetails and outputDetails properties. For
|
step-functions-dg-245
|
step-functions-dg.pdf
| 245 |
| FAILED | TIMED_OUT | ABORTED | PENDING_REDRIVE" } } Remarks An Execution Status Change event can contain an input property in its definition. For some events, an Execution Status Change event can also contain an output property in its definition. • If the combined escaped input and escaped output sent to EventBridge exceeds 248 KiB, then the input will be excluded. Similarly, if the escaped output exceeds 248 KiB, then the output will be excluded. This is a result of events quotas. • You can determine whether a payload has been truncated with the inputDetails and outputDetails properties. For more information, see the CloudWatchEventsExecutionDataDetails Data Type. • For Standard Workflows, use DescribeExecution to see the full input and output. DescribeExecution is not available for Express Workflows. If you want to see the full input/ output, you can: • Wrap your Express Workflow with a Standard Workflow. • Use Amazon S3 ARNs. For information about using ARNs, see the section called “Using Amazon S3 to pass large data”. Examples Example Execution Status Change: execution started { Events detail reference 900 AWS Step Functions "version": "0", "id": "315c1398-40ff-a850-213b-158f73e60175", "detail-type": "Step Functions Execution Status Change", Developer Guide "source": "aws.states", "account": "account-id", "time": "2019-02-26T19:42:21Z", "region": "us-east-2", "resources": [ "arn:aws:states:us-east-2:account-id:execution:state-machine-name:execution-name" ], "detail": { "executionArn": "arn:aws:states:us-east-2:account-id:execution:state-machine- name:execution-name", "stateMachineArn": "arn:aws::states:us-east-2:account-id:stateMachine:state- machine", "name": "execution-name", "status": "RUNNING", "startDate": 1551225271984, "stopDate": null, "input": "{}", "inputDetails": { "included": true }, "output": null, "outputDetails": null } } Example Execution Status Change: execution succeeded { "version": "0", "id": "315c1398-40ff-a850-213b-158f73e60175", "detail-type": "Step Functions Execution Status Change", "source": "aws.states", "account": "account-id", "time": "2019-02-26T19:42:21Z", "region": "us-east-2", "resources": [ "arn:aws:states:us-east-2:account-id:execution:state-machine-name:execution-name" ], "detail": { Events detail reference 901 AWS Step Functions Developer Guide "executionArn": "arn:aws:states:us-east-2:account-id:execution:state-machine- name:execution-name", "stateMachineArn": "arn:aws:states:us-east-2:account-id:stateMachine:state- machine", "name": "execution-name", "status": "SUCCEEDED", "startDate": 1547148840101, "stopDate": 1547148840122, "input": "{}", "inputDetails": { "included": true }, "output": "\"Hello World!\"", "outputDetails": { "included": true } } } Example Execution Status Change: execution failed { "version": "0", "id": "315c1398-40ff-a850-213b-158f73e60175", "detail-type": "Step Functions Execution Status Change", "source": "aws.states", "account": "account-id", "time": "2019-02-26T19:42:21Z", "region": "us-east-2", "resources": [ "arn:aws:states:us-east-2:account-id:execution:state-machine-name:execution-name" ], "detail": { "executionArn": "arn:aws:states:us-east-2:account-id:execution:state-machine- name:execution-name", "stateMachineArn": "arn:aws:states:us-east-2:account-id:stateMachine:state- machine", "name": "execution-name", "status": "FAILED", "startDate": 1551225146847, "stopDate": 1551225151881, "input": "{}", "inputDetails": { Events detail reference 902 AWS Step Functions Developer Guide "included": true }, "output": null, "outputDetails": null } } Example Execution Status Change: timed-out { "version": "0", "id": "315c1398-40ff-a850-213b-158f73e60175", "detail-type": "Step Functions Execution Status Change", "source": "aws.states", "account": "account-id", "time": "2019-02-26T19:42:21Z", "region": "us-east-2", "resources": [ "arn:aws:states:us-east-2:account-id:execution:state-machine-name:execution-name" ], "detail": { "executionArn": "arn:aws:states:us-east-2:account-id:execution:state-machine- name:execution-name", "stateMachineArn": "arn:aws:states:us-east-2:account-id:stateMachine:state- machine", "name": "execution-name", "status": "TIMED_OUT", "startDate": 1551224926156, "stopDate": 1551224927157, "input": "{}", "inputDetails": { "included": true }, "output": null, "outputDetails": null Example Execution Status Change: aborted { "version": "0", "id": "315c1398-40ff-a850-213b-158f73e60175", "detail-type": "Step Functions Execution Status Change", Events detail reference 903 AWS Step Functions Developer Guide "source": "aws.states", "account": "account-id", "time": "2019-02-26T19:42:21Z", "region": "us-east-2", "resources": [ "arn:aws:states:us-east-2:account-id:execution:state-machine-name:execution-name" ], "detail": { "executionArn": "arn:aws:states:us-east-2:account-id:execution:state-machine- name:execution-name", "stateMachineArn": "arn:aws:states:us-east-2:account-id:stateMachine:state- machine", "name": "execution-name", "status": "ABORTED", "startDate": 1551225014968, "stopDate": 1551225017576, "input": "{}", "inputDetails": { "included": true }, "output": null, "outputDetails": null } } Recording Step Functions API calls with AWS CloudTrail AWS Step Functions is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service. CloudTrail captures all API calls for Step Functions as events. The calls captured include calls from the Step Functions console and code calls to the Step Functions API operations. Using the information collected by CloudTrail, you can determine the request that was made to Step Functions, the IP address from which the request was made, when it was made, and additional details. Every event or log entry contains information about who generated the request. The identity information helps you determine the following: • Whether the request was made with root user or user credentials. • Whether the request was made on behalf of an IAM Identity Center user. • Whether the request was made with temporary security credentials for a role or federated user. API calls in CloudTrail 904 AWS Step Functions Developer Guide • Whether the request was made by another AWS service. CloudTrail is active in your AWS account when you create the account and you automatically have access to the CloudTrail Event history. The CloudTrail Event history provides a viewable, searchable, downloadable, and immutable record of the past 90 days of recorded management events in an AWS Region. For more information, see Working with CloudTrail Event history in the AWS CloudTrail User Guide. There are no CloudTrail charges for viewing the Event history. For an ongoing record of events in your AWS account past 90 days, create a trail or a CloudTrail Lake event data store. CloudTrail trails A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. All trails created using the AWS Management Console are multi-Region. You can create a single-Region or a multi-Region
|
step-functions-dg-246
|
step-functions-dg.pdf
| 246 |
viewable, searchable, downloadable, and immutable record of the past 90 days of recorded management events in an AWS Region. For more information, see Working with CloudTrail Event history in the AWS CloudTrail User Guide. There are no CloudTrail charges for viewing the Event history. For an ongoing record of events in your AWS account past 90 days, create a trail or a CloudTrail Lake event data store. CloudTrail trails A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. All trails created using the AWS Management Console are multi-Region. You can create a single-Region or a multi-Region trail by using the AWS CLI. Creating a multi-Region trail is recommended because you capture activity in all AWS Regions in your account. If you create a single-Region trail, you can view only the events logged in the trail's AWS Region. For more information about trails, see Creating a trail for your AWS account and Creating a trail for an organization in the AWS CloudTrail User Guide. You can deliver one copy of your ongoing management events to your Amazon S3 bucket at no charge from CloudTrail by creating a trail, however, there are Amazon S3 storage charges. For more information about CloudTrail pricing, see AWS CloudTrail Pricing. For information about Amazon S3 pricing, see Amazon S3 Pricing. CloudTrail Lake event data stores CloudTrail Lake lets you run SQL-based queries on your events. CloudTrail Lake converts existing events in row-based JSON format to Apache ORC format. ORC is a columnar storage format that is optimized for fast retrieval of data. Events are aggregated into event data stores, which are immutable collections of events based on criteria that you select by applying advanced event selectors. The selectors that you apply to an event data store control which events persist and are available for you to query. For more information about CloudTrail Lake, see Working with AWS CloudTrail Lake in the AWS CloudTrail User Guide. CloudTrail Lake event data stores and queries incur costs. When you create an event data store, you choose the pricing option you want to use for the event data store. The pricing option determines the cost for ingesting and storing events, and the default and maximum API calls in CloudTrail 905 AWS Step Functions Developer Guide retention period for the event data store. For more information about CloudTrail pricing, see AWS CloudTrail Pricing. Data events in CloudTrail Data events provide information about the resource operations performed on or in a resource (for example, reading or writing to an Amazon S3 object). These are also known as data plane operations. Data events are often high-volume activities. By default, CloudTrail doesn’t log data events. The CloudTrail Event history doesn't record data events. Additional charges apply for data events. For more information about CloudTrail pricing, see AWS CloudTrail Pricing. You can log data events for the Step Functions resource types by using the CloudTrail console, AWS CLI, or CloudTrail API operations. For more information about how to log data events, see Logging data events with the AWS Management Console and Logging data events with the AWS Command Line Interface in the AWS CloudTrail User Guide. The following table lists the Step Functions resource types for which you can log data events. The Data event type column shows the value to choose from the Data event type list on the CloudTrail console. The resources.type value column shows the resources.type value, which you would specify when configuring advanced event selectors using the AWS CLI or CloudTrail APIs. The Data APIs logged to CloudTrail column shows the API calls logged to CloudTrail for the resource type. You can configure advanced event selectors to filter on the eventName, readOnly, and resources.ARN fields to log only those events that are important to you. For more information about these fields, see AdvancedFieldSelector in the AWS CloudTrail API Reference. Data event type resources.type value Data APIs logged to CloudTrail Step Functions state machine AWS::StepFunctions • InvokeHTTPEndpoint ::StateMachine • StartSyncExecution Step Functions activity AWS::StepFunctions • GetActivityTask ::Activity Data events in CloudTrail 906 AWS Step Functions Developer Guide Management events in CloudTrail Management events provide information about management operations that are performed on resources in your AWS account. These are also known as control plane operations. By default, CloudTrail logs management events. State Machine • CreateStateMachine • ListStateMachines • DescribeStateMachine • UpdateStateMachine • DeleteStateMachine • ValidateStateMachineDefinition • TestState State Machine Alias • CreateStateMachineAlias • ListStateMachineAliases • DescribeStateMachineAlias • UpdateStateMachineAlias • DeleteStateMachineAlias State Machine Version • ListStateMachineVersions • PublishStateMachineVersion • DeleteStateMachineVersion Executions • StartExecution • StartSyncExecution Management events in CloudTrail 907 AWS Step Functions • RedriveExecution • ListExecutions • DescribeExecution • GetExecutionHistory • DescribeStateMachineForExecution • StopExecution Activity • CreateActivity • ListActivities • DescribeActivity • DeleteActivity • GetActivityTask Task Token • SendTaskSuccess • SendTaskHeartbeat • SendTaskFailure MapRun • ListMapRuns • DescribeMapRun
|
step-functions-dg-247
|
step-functions-dg.pdf
| 247 |
are also known as control plane operations. By default, CloudTrail logs management events. State Machine • CreateStateMachine • ListStateMachines • DescribeStateMachine • UpdateStateMachine • DeleteStateMachine • ValidateStateMachineDefinition • TestState State Machine Alias • CreateStateMachineAlias • ListStateMachineAliases • DescribeStateMachineAlias • UpdateStateMachineAlias • DeleteStateMachineAlias State Machine Version • ListStateMachineVersions • PublishStateMachineVersion • DeleteStateMachineVersion Executions • StartExecution • StartSyncExecution Management events in CloudTrail 907 AWS Step Functions • RedriveExecution • ListExecutions • DescribeExecution • GetExecutionHistory • DescribeStateMachineForExecution • StopExecution Activity • CreateActivity • ListActivities • DescribeActivity • DeleteActivity • GetActivityTask Task Token • SendTaskSuccess • SendTaskHeartbeat • SendTaskFailure MapRun • ListMapRuns • DescribeMapRun • UpdateMapRun Tags • ListTagsForResource • TagResource • UntagResource Management events in CloudTrail Developer Guide 908 AWS Step Functions Event examples Developer Guide An event represents a single request from any source and includes information about the requested API operation, the date and time of the operation, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so events don't appear in any specific order. The following example shows a CloudTrail data event that demonstrates InvokeHTTPEndpoint. { "eventVersion": "1.09", "userIdentity": { "accountId": "account-id", "invokedBy": "states.amazonaws.com" }, "eventTime": "2024-05-01T01:23:45Z", "eventSource": "states.amazonaws.com", "eventName": "InvokeHTTPEndpoint", "awsRegion": "us-east-1", "sourceIPAddress": "states.amazonaws.com", "userAgent": "states.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "a1b2c3d4-5678-90ab-cdef-EXAMPLEaaaaa", "readOnly": false, "resources": [ { "accountId": "account-id", "type": "AWS::StepFunctions::StateMachine", "ARN": "arn:aws:states:region:account-id:stateMachine:ExampleStateMachine" } ], "eventType": "AwsServiceEvent", "managementEvent": false, "recipientAccountId": "account-id", "serviceEventDetails": { "httpMethod": "GET", "httpEndpoint": "https://example.com" }, "eventCategory": "Data" } Event examples 909 AWS Step Functions Developer Guide The following example shows a CloudTrail management event that demonstrates the CreateStateMachine operation. { "eventVersion": "1.08", "userIdentity": { "type": "IAMUser", "principalId": "AIDAJYDLDBVBI4EXAMPLE", "arn": "arn:aws:iam::account-id:user/test-user", "accountId": "account-id", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "test-user" }, "eventTime": "2024-05-01T01:23:45Z", "eventSource": "states.amazonaws.com", "eventName": "CreateStateMachine", "awsRegion": "region", "sourceIPAddress": "AWS Internal", "userAgent": "AWS Internal", "requestParameters": { "name": "MyStateMachine", "definition": "HIDDEN_DUE_TO_SECURITY_REASONS", "roleArn": "arn:aws:iam::account-id:role/MyStateMachineRole", "type": "STANDARD", "loggingConfiguration": { "level": "OFF", "includeExecutionData": false }, "tags": [], "tracingConfiguration": { "enabled": false }, "publish": false }, "responseElements": { "stateMachineArn": "arn:aws:states:region:account- id:stateMachine:MyStateMachine", "creationDate": "May 1, 2024 1:23:45 AM" }, "requestID": "a1b2c3d4-5678-90ab-cdef-EXAMPLEaaaaa", "eventID": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "readOnly": false, "eventType": "AwsApiCall", Event examples 910 AWS Step Functions Developer Guide "managementEvent": true, "recipientAccountId": "account-id", "eventCategory": "Management" } For information about CloudTrail record contents, see CloudTrail record contents in the AWS CloudTrail User Guide. Using CloudWatch Logs to log execution history in Step Functions Standard Workflows record execution history in AWS Step Functions, although you can optionally configure logging to Amazon CloudWatch Logs. Unlike Standard Workflows, Express Workflows don't record execution history in AWS Step Functions. To see execution history and results for an Express Workflow, you must configure logging to Amazon CloudWatch Logs. Publishing logs doesn't block or slow down executions. Note When you configure logging, CloudWatch Logs charges will apply and you will be billed at the vended logs rate. For more information, see Vended Logs under the Logs tab on the CloudWatch Pricing page. Configure logging When you create a Standard Workflow using the Step Functions console, that state machine will not be configured to send logs to CloudWatch Logs. When you create an Express Workflow using the Step Functions console, that state machine will by default be configured to send logs to CloudWatch Logs. For Express workflows, Step Functions can create a role with the necessary AWS Identity and Access Management (IAM) policy for CloudWatch Logs. If you create a Standard Workflow, or an Express Workflow using the API, CLI, or AWS CloudFormation, Step Functions will not enable logging by default, and you will need ensure your role has the necessary permissions. For each execution started from the console, Step Functions provides a link to CloudWatch Logs, configured with the correct filter to fetch log events specific for that execution. Logging in CloudWatch Logs 911 AWS Step Functions Developer Guide You can optionally configure customer managed AWS KMS keys to encrypt your logs. See Data at rest encryption for details and permission settings. To configure logging, you can pass the LoggingConfiguration parameter when using CreateStateMachine or UpdateStateMachine. You can further analyze your data in CloudWatch Logs by using CloudWatch Logs Insights. For more information see Analyzing Log Data with CloudWatch Logs Insights. CloudWatch Logs payloads Execution history events may contain either input or output properties in their definitions. If escaped input or escaped output sent to CloudWatch Logs exceeds 248 KiB, it will be truncated as a result of CloudWatch Logs quotas. • You can determine whether a payload has been truncated by reviewing the inputDetails and outputDetails properties. For more information, see the HistoryEventExecutionDataDetails Data Type. • For Standard Workflows, you can see the full execution history by using GetExecutionHistory. • GetExecutionHistory is not available for Express Workflows. If you want to see the full input and output, you can use Amazon S3 ARNs. For more information, see the section called “Using Amazon S3 to pass large
|
step-functions-dg-248
|
step-functions-dg.pdf
| 248 |
If escaped input or escaped output sent to CloudWatch Logs exceeds 248 KiB, it will be truncated as a result of CloudWatch Logs quotas. • You can determine whether a payload has been truncated by reviewing the inputDetails and outputDetails properties. For more information, see the HistoryEventExecutionDataDetails Data Type. • For Standard Workflows, you can see the full execution history by using GetExecutionHistory. • GetExecutionHistory is not available for Express Workflows. If you want to see the full input and output, you can use Amazon S3 ARNs. For more information, see the section called “Using Amazon S3 to pass large data”. IAM Policies for logging to CloudWatch Logs You will also need to configure your state machine's execution IAM role to have the proper permission to log to CloudWatch Logs as shown in the following example. IAM policy example The following is an example policy you can use to configure your permissions. As shown in the following example, you need to specify * in the Resource field. CloudWatch API actions, such as CreateLogDelivery and DescribeLogGroups, do not support Resource types defined by Amazon CloudWatch Logs. For more information, see Actions defined by Amazon CloudWatch Logs. • For information about CloudWatch resources, see CloudWatch Logs resources and operations in the Amazon CloudWatch User Guide. CloudWatch Logs payloads 912 AWS Step Functions Developer Guide • For information about the permissions you need to set up sending logs to CloudWatch Logs, see User permissions in the section titled Logs sent to CloudWatch Logs. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogDelivery", "logs:CreateLogStream", "logs:GetLogDelivery", "logs:UpdateLogDelivery", "logs:DeleteLogDelivery", "logs:ListLogDeliveries", "logs:PutLogEvents", "logs:PutResourcePolicy", "logs:DescribeResourcePolicies", "logs:DescribeLogGroups" ], "Resource": "*" } ] } Troubleshooting state machine logging to CloudWatch Logs If your state machine cannot send logs to CloudWatch Logs, try the following steps: 1. Verify your state machine's execution role has permission to log to CloudWatch Logs. When you call CreateStateMachine or UpdateStateMachine API endpoints, make sure the IAM role specified in the roleArn parameter provides the necessary permissions, shown in the preceding IAM policy example. 2. Verify the CloudWatch Logs resource policy does not exceed the 5,120 character limit. If the policy exceeds the character limit, prefix your log group names with /aws/vendedlogs/ states to grant permissions to your state machines and avoid the limit. When you create a log group in the Step Functions console, the suggested log group names are already prefixed with IAM Policies for logging to CloudWatch Logs 913 AWS Step Functions Developer Guide /aws/vendedlogs/states. For more information on logging best practices, see CloudWatch Logs resource policy size limits. Log levels for Step Functions execution events Log levels range from ALL to ERROR to FATAL to OFF. All event types are logged for ALL, no event types are logged when set to OFF. For ERROR and FATAL, see the following table. For more information about the execution data displayed for Express Workflow executions based on these Log levels, see Standard and Express console experience differences. Event Type ALL ERROR FATAL OFF ChoiceSta teEntered ChoiceSta teExited Execution Aborted Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged Logged Logged Logged Not logged ExecutionFailed Logged Logged Logged Not logged Execution Started Execution Succeeded Execution TimedOut Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged Logged Logged Logged Not logged FailStateEntered Logged LambdaFun ctionFailed Logged Logged Logged Not logged Not logged Not logged Not logged Event log levels 914 AWS Step Functions Developer Guide Event Type ALL ERROR FATAL OFF LambdaFun ctionScheduled LambdaFun ctionSche duleFailed LambdaFun ctionStarted LambdaFun ctionStartFailed LambdaFun ctionSucceeded LambdaFun ctionTimedOut MapIterat ionAborted MapIterat ionFailed MapIterat ionStarted MapIterat ionSucceeded Logged Not logged Not logged Not logged Logged Logged Not logged Not logged Logged Not logged Not logged Not logged Logged Logged Not logged Not logged Logged Not logged Not logged Not logged Logged Logged Not logged Not logged Logged Logged Not logged Not logged Logged Logged Not logged Not logged Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged MapRunAborted Logged MapRunFailed Logged MapStateA borted Logged Logged Logged Logged Not logged Not logged Not logged Not logged Not logged Not logged Event log levels 915 AWS Step Functions Developer Guide Event Type ALL ERROR FATAL OFF MapStateE ntered Logged Not logged Not logged Not logged MapStateExited Logged Not logged Not logged Not logged MapStateFailed Logged Logged Not logged Not logged MapStateS tarted MapStateS ucceeded ParallelS tateAborted ParallelS tateEntered ParallelS tateExited ParallelS tateFailed ParallelS tateStarted ParallelS tateSucceeded PassState Entered Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged Logged Logged Not logged Not logged Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged Logged Logged Not logged Not logged Logged Not logged Not logged Not logged Logged Not
|
step-functions-dg-249
|
step-functions-dg.pdf
| 249 |
Functions Developer Guide Event Type ALL ERROR FATAL OFF MapStateE ntered Logged Not logged Not logged Not logged MapStateExited Logged Not logged Not logged Not logged MapStateFailed Logged Logged Not logged Not logged MapStateS tarted MapStateS ucceeded ParallelS tateAborted ParallelS tateEntered ParallelS tateExited ParallelS tateFailed ParallelS tateStarted ParallelS tateSucceeded PassState Entered Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged Logged Logged Not logged Not logged Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged Logged Logged Not logged Not logged Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged Logged Not logged Not logged Not logged PassStateExited Logged Not logged Not logged Not logged SucceedSt ateEntered Event log levels Logged Not logged Not logged Not logged 916 AWS Step Functions Developer Guide Event Type ALL ERROR FATAL OFF SucceedSt ateExited Logged Not logged Not logged Not logged TaskFailed Logged Logged Not logged Not logged TaskScheduled Logged Not logged Not logged Not logged TaskStarted Logged Not logged Not logged Not logged TaskStartFailed Logged Logged Logged Logged Not logged Not logged Not logged Not logged TaskState Aborted TaskState Entered WaitState Aborted WaitState Entered Logged Not logged Not logged Not logged TaskStateExited Logged Not logged Not logged Not logged TaskSubmi tFailed Logged Logged Not logged Not logged TaskSubmitted Logged Not logged Not logged Not logged TaskSucceeded Logged Not logged Not logged Not logged TaskTimedOut Logged Logged Logged Logged Not logged Not logged Not logged Not logged Logged Not logged Not logged Not logged WaitStateExited Logged Not logged Not logged Not logged Event log levels 917 AWS Step Functions Developer Guide Trace Step Functions request data in AWS X-Ray You can use AWS X-Ray to visualize the components of your state machine, identify performance bottlenecks, and troubleshoot requests that resulted in an error. Your state machine sends trace data to X-Ray, and X-Ray processes the data to generate a service map and searchable trace summaries. With X-Ray enabled for your state machine, you can trace requests as they are executed in Step Functions, in all AWS Regions where X-Ray is available. This gives you a detailed overview of an entire Step Functions request. Step Functions will send traces to X-Ray for state machine executions, even when a trace ID is not passed by an upstream service. You can use an X-Ray service map to view the latency of a request, including any AWS services that are integrated with X-Ray. You can also configure sampling rules to tell X-Ray which requests to record, and at what sampling rates, according to criteria that you specify. When X-Ray is not enabled for your state machine, and an upstream service does not pass a trace ID, Step Functions will not send traces to X-Ray for state machine executions. However, if a trace ID is passed by an upstream service, Step Functions will then send traces to X-Ray for state machine executions. You can use AWS X-Ray with Step Functions in regions where both are supported. See the Step Functions and X-Ray endpoints and quotas pages for information on region support for X-Ray and Step Functions. X-Ray and Step Functions Combined Quotas You can add data to a trace for up to seven days, and query trace data going back thirty days, the length of time that X-Ray stores trace data. Your traces will be subject to X-Ray quotas. In addition to other quotas, X-Ray provides a minimum guaranteed trace size of 100 KiB for Step Functions state machines. If more than 100 KiB of trace data is provided to X-Ray, this may result in a frozen trace. See the service quotas section of the X-Ray endpoints and quotas page for more information on other quotas for X-Ray. Trace data in X-Ray 918 AWS Step Functions Important Developer Guide Step Functions doesn't support X-Ray tracing for the child workflow executions started by a Distributed Map state because it's easy to exceed the Trace document size limit for such executions. Topics • Setup and configuration • Concepts • Step Functions service integrations and X-Ray • Viewing the X-Ray console • Viewing X-Ray tracing information for Step Functions • Traces • Service map • Segments and subsegments • Analytics • Configuration • What if there is no data in the trace map or service map? Setup and configuration Enable X-Ray tracing when creating a state machine You can enable X-Ray tracing when creating a new state machine by selecting Enable X-Ray tracing on the Specify details page. 1. Open the Step Functions console and choose Create state machine. 2. On the Choose authoring method page, choose an appropriate option to create your state machine. If you choose Run a sample project, you cannot enable X-Ray tracing during the state machine creation, and you will need
|
step-functions-dg-250
|
step-functions-dg.pdf
| 250 |
and subsegments • Analytics • Configuration • What if there is no data in the trace map or service map? Setup and configuration Enable X-Ray tracing when creating a state machine You can enable X-Ray tracing when creating a new state machine by selecting Enable X-Ray tracing on the Specify details page. 1. Open the Step Functions console and choose Create state machine. 2. On the Choose authoring method page, choose an appropriate option to create your state machine. If you choose Run a sample project, you cannot enable X-Ray tracing during the state machine creation, and you will need to enable X-Ray tracing after your state machine has been created. For more information about enabling X-Ray in an existing state machine, see Enable X- Ray in an existing state machine. Setup and configuration 919 AWS Step Functions Choose Next. 3. On the Specify details page, configure your state machine. 4. Choose Enable X-Ray tracing. Developer Guide Your Step Functions state machine will now send traces to X-Ray for state machine executions. Note If you choose to use an existing IAM role, you should ensure that X-Ray writes are allowed. For more information about the permissions that you need, see the following topic. IAM policies using AWS X-Ray in Step Functions To enable X-Ray tracing, you will need an IAM policy with suitable permissions to allow tracing. If your state machine uses other integrated services, you may need additional IAM policies. See the IAM policies for your specific service integrations. If you enable X-Ray tracing for an existing state machine you must ensure that you add a policy with sufficient permissions to enable X-Ray traces. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "xray:PutTraceSegments", "xray:PutTelemetryRecords", "xray:GetSamplingRules", "xray:GetSamplingTargets" ], "Resource": [ "*" ] } ] } Setup and configuration 920 AWS Step Functions Developer Guide Enable X-Ray in an existing state machine To enable X-Ray in an existing state machine: 1. In the Step Functions console, select the state machine for which you want to enable tracing. 2. Choose Edit. 3. Choose Enable X-Ray tracing. You will see a notification telling you that you that you may need to make additional changes. Note When you enable X-Ray for an existing state machine, you must ensure that you have an IAM policy that grants sufficient permissions for X-Ray to perform traces. You can either add one manually, or generate one. For more information, see the IAM policy section for IAM policies using AWS X-Ray in Step Functions. 4. (Optional) Auto-generate a new role for your state machine to include X-Ray permissions. 5. Choose Save. Configure X-Ray tracing for Step Functions When you first run a state machine with X-Ray tracing enabled, it will use the default configuration values for X-Ray tracing. AWS X-Ray does not collect data for every request that is sent to an application. Instead, it collects data for a statistically significant number of requests. The default is to record the first request each second, and five percent of any additional requests. One request per second is the reservoir. This ensures that at least one trace is recorded each second as long as the service is serving requests. Five percent is the rate at which additional requests beyond the reservoir size are sampled. To avoid incurring service charges when you are getting started, the default sampling rate is conservative. You can configure X-Ray to modify the default sampling rule and configure additional rules that apply sampling based on properties of the service or request. For example, you might want to disable sampling and trace all requests for calls that modify state or handle AWS accounts or transactions. For high-volume read-only calls, like background polling, health checks, or connection maintenance, you can sample at a low rate and still get enough data to observe issues that occur. Setup and configuration 921 AWS Step Functions Developer Guide To configure a sampling rule for your state machine: 1. Go to the X-Ray console. 2. Choose Sampling. 3. To create a rule, choose Create sampling rule. To edit a rule, choose a rule's name. To delete a rule, choose a rule and use the Actions menu to delete it. Some parts of existing sampling rules, such as the name and priority, cannot be changed. Instead, add or clone an existing rule, make the changes you want, then use the new rule. For detailed information on X-Ray sampling rules and how to configure the various parameters, see Configuring sampling rules in the X-Ray console. Integrate upstream services To integrate the execution of Step Functions workflows, such as Express, Synchronous, and Standard workflows, with an upstream service you need to set the traceHeader. This is automatically done for you if you are using a HTTP API in API Gateway. However, if you're using a
|
step-functions-dg-251
|
step-functions-dg.pdf
| 251 |
existing sampling rules, such as the name and priority, cannot be changed. Instead, add or clone an existing rule, make the changes you want, then use the new rule. For detailed information on X-Ray sampling rules and how to configure the various parameters, see Configuring sampling rules in the X-Ray console. Integrate upstream services To integrate the execution of Step Functions workflows, such as Express, Synchronous, and Standard workflows, with an upstream service you need to set the traceHeader. This is automatically done for you if you are using a HTTP API in API Gateway. However, if you're using a Lambda function and/or an SDK, you need to set the traceHeader on the StartExecution or StartSyncExecution API calls yourself. You must specify the traceHeader format as \p{ASCII}#. Additionally, to let Step Functions use the same trace ID, you must specify the format as Root={TRACE_ID};Sampled={1 or 0}. If you're using a Lambda function, replace the TRACE_ID with the trace ID in your current segment and set the Sampled field as 1 if your sampling mode is true and 0 if your sampling mode is false. Providing the trace ID in this format ensures that you'll get a complete trace. The following is an example written in Python to showcase how to specify the traceHeader. state_machine = config.get_string_paramter("STATE_MACHINE_ARN") if (xray_recorder.current_subsegment() is not None and xray_recorder.current_subsegment().sampled) : trace_id = "Root={};Sampled=1".format( xray_recorder.current_subsegment().trace_id ) else: Setup and configuration 922 AWS Step Functions Developer Guide trace_id = "Root=not enabled;Sampled=0" LOGGER.info("trace %s", trace_id) # execute it response = states.start_sync_execution( stateMachineArn=state_machine, input=event['body'], name=context.aws_request_id, traceHeader=trace_id ) LOGGER.info(response) X-Ray trace in header or payload For X-Ray traces, all AWS services use the X-Amzn-Trace-Id header from the HTTP request. Using the header is the preferred mechanism to identify a trace. StartExecution and StartSyncExecution API operations can also use traceHeader from the body of the request payload. If both sources are provided, Step Functions will use the header value (preferred) over the value in the request body. Concepts The X-Ray console In the AWS X-Ray console, you can view service maps and traces for requests that your applications serve when X-Ray is enabled for your state machine. See Viewing the X-Ray console for information on how to access the X-Ray console for your state machine executions. For detailed information about the X-Ray console, see the X-Ray console documentation. Segments, subsegments, and traces A segment records information about a request to your state machine. It contains information such as the work that your state machine performs, and may also contain subsegments with information about downstream calls. A trace collects all the segments generated by a single request. Concepts 923 AWS Step Functions Sampling Developer Guide To ensure efficient tracing and provide a representative sample of the requests that your application serves, X-Ray applies a sampling algorithm to determine which requests get traced. This can be changed by editing the sampling rules. Metrics For your state machine, X-Ray will meter invocation time, state transition time, the overall execution time of Step Functions, and variances in this execution time. This information can be accessed through the X-Ray console. Analytics The AWS X-Ray Analytics console is an interactive tool for interpreting trace data. You can refine the active dataset with increasingly granular filters by clicking the graphs and the panels of metrics and fields that are associated with the current trace set. You can analyze how your state machine is performing to locate and identify performance issues. For detailed information about X-Ray analytics, see Interacting with the AWS X-Ray Analytics console Step Functions service integrations and X-Ray Some of the AWS services that integrate with Step Functions provide integration with AWS X-Ray by adding a tracing header to requests, running the X-Ray daemon, or making sampling decisions and uploading trace data to X-Ray. Others must be instrumented using the AWS X-Ray SDK. A few do not yet support X-Ray integration. X-Ray integration is necessary to provide complete trace data when using a service integration with Step Functions Native X-Ray support Service integrations with native X-Ray support include: • Amazon Simple Notification Service • Amazon Simple Queue Service • AWS Lambda • AWS Step Functions Service integrations 924 AWS Step Functions Instrumentation required Service integrations that require X-Ray instrumentation: Developer Guide • Amazon Elastic Container Service • AWS Batch • AWS Fargate Client-side trace only Other service integrations do not support X-Ray traces. However, client side traces can still be collected: • Amazon DynamoDB • Amazon EMR • Amazon SageMaker AI • AWS CodeBuild • AWS Glue Viewing the X-Ray console X-Ray receives data from services as segments. X-Ray groups segments that have a common request into traces. X-Ray processes the traces to generate a service graph that provides a visual representation of your application. After you start your state machine's execution, you can view its X-Ray
|
step-functions-dg-252
|
step-functions-dg.pdf
| 252 |
X-Ray instrumentation: Developer Guide • Amazon Elastic Container Service • AWS Batch • AWS Fargate Client-side trace only Other service integrations do not support X-Ray traces. However, client side traces can still be collected: • Amazon DynamoDB • Amazon EMR • Amazon SageMaker AI • AWS CodeBuild • AWS Glue Viewing the X-Ray console X-Ray receives data from services as segments. X-Ray groups segments that have a common request into traces. X-Ray processes the traces to generate a service graph that provides a visual representation of your application. After you start your state machine's execution, you can view its X-Ray traces by choosing the X-Ray trace map link in the Execution details section. After you have enabled X-Ray for your state machine, you can view tracing information for its executions in the X-Ray console. Viewing X-Ray tracing information for Step Functions The following steps illustrate what kind of information you can see in the console after you enable X-Ray and run an execution. X-Ray traces for the Create a callback pattern example with Amazon SQS, Amazon SNS, and Lambda sample project are shown. Viewing the X-Ray console 925 AWS Step Functions Traces Developer Guide After the an execution has finished, you can navigate to the X-Ray console, where you will see the X-Ray Traces page. This displays an overview of the service map as well as trace and segment information for your state machine. Service map The service map in the X-Ray console helps you to identify services where errors are occurring, where there are connections with high latency, or see traces for requests that were unsuccessful. Traces 926 AWS Step Functions Developer Guide On the trace map, you can choose a service node to view requests for that node, or an edge between two nodes to view requests that traveled that connection. Here, the WaitForCallBack node has been selected, and you can view additional information about its execution and response status. You can see how the X-Ray service map correlates to the state machine. There is a service map node for each service integration that is called by Step Functions, provided it supports X-Ray. Service map 927 AWS Step Functions Developer Guide Segments and subsegments A trace is a collection of segments generated by a single request. Each segment provides the resource's name, details about the request, and details about the work done. On the Traces page, you can see the segments and, if expanded, its corresponding subsegments. You can choose a segment or subsegment to view detailed information about it. You will be a different segment for each node on the service map. Segments and subsegments 928 AWS Step Functions Developer Guide Choosing a segment provides the resource's name, details about the request, and details about the work done. A segment can break down the data about the work done into subsegments. Choosing a subsegment shows granular timing information and details. A subsegment can contain additional details about a call to an AWS service, an external HTTP API, or an SQL database. Analytics The AWS X-Ray Analytics console is an interactive tool for interpreting trace data. You can use this to more easily understand how your state machine is performing. You can explore, analyze, and visualize traces through interactive response time and time-series graphs to help locate performance and latency issues. You can refine the active dataset with increasingly granular filters by clicking the graphs and the panels of metrics and fields that are associated with the current trace set. Configuration You can configure sampling and encryption options from the X-Ray console. • Choose Sampling to view details about the sampling rate and configuration. You can change the sampling rules to control the amount of data that you record, and modify sampling behavior to suit your specific requirements. • Choose Encryption to modify the encryption settings. Analytics 929 AWS Step Functions Developer Guide You can use the default setting, where X-Ray encrypts traces and data at rest, or, if needed, you can choose a KMS key. Standard AWS KMS charges apply in the latter case. What if there is no data in the trace map or service map? If you have enabled X-Ray, but can't see any data in the X-Ray console, check that: • Your IAM roles are set up correctly to allow writing to X-Ray. • Sampling rules allow sampling of data. • Since there can be a short delay before newly created or modified IAM roles are applied, check the trace or service maps again after a few minutes. • If you see Data Not Found in the X-Ray Traces panel, check your IAM account settings and ensure that AWS Security Token Service is enabled for the intended region. For more information, see Activating and deactivating AWS STS in an AWS Region in the IAM
|
step-functions-dg-253
|
step-functions-dg.pdf
| 253 |
in the X-Ray console, check that: • Your IAM roles are set up correctly to allow writing to X-Ray. • Sampling rules allow sampling of data. • Since there can be a short delay before newly created or modified IAM roles are applied, check the trace or service maps again after a few minutes. • If you see Data Not Found in the X-Ray Traces panel, check your IAM account settings and ensure that AWS Security Token Service is enabled for the intended region. For more information, see Activating and deactivating AWS STS in an AWS Region in the IAM User Guide. Setting up Step Functions event notification using AWS User Notifications You can use AWS User Notifications to set up delivery channels to get notified about AWS Step Functions events. You receive a notification when an event matches a rule that you specify. You can receive notifications for events through multiple channels, including email, Amazon Q Developer in chat applications chat notifications, or AWS Console Mobile Application push notifications. You can also see notifications in the Console Notifications Center. User Notifications supports aggregation, which can reduce the number of notifications you receive during specific events. What if there is no data in the trace map or service map? 930 AWS Step Functions Developer Guide Testing and debugging Step Functions state machines Step Functions provides the following ways to test and debug state machines: Test with Test State in console and API In the Step Functions console, you can test an individual state with Test State. You provide the state definition and inputs in the console, then Step Functions runs the state and shows the outputs, all without creating a state machine. Or, you can use the TestState API to test an individual state. You provide the definition of a single state, and the API will execute the state and report results, also without creating an actual state machine. See Testing with TestState through the TestState API to test your states. Data flow simulator (unsupported) Data flow simulator is a console tool that was built to test JSONPath syntax. The data flow simulator is unsupported. See Testing with TestState through the TestState API to test your states. Step Functions Local (unsupported) With AWS Step Functions Local, a downloadable version of Step Functions, you can test applications with Step Functions running in your own development environment. Step Functions Local does not provide feature parity. For example, there is no support for optimized service integrations, cross-account access, or distributed map. Step Functions Local is unsupported Step Functions Local does not provide feature parity and is unsupported. You might consider third party solutions that emulate Step Functions for testing purposes. Test with Test State 931 AWS Step Functions Developer Guide Using TestState API to test a state in Step Functions The TestState API accepts the definition of a single state and executes it. You can test a state without creating a state machine or updating an existing state machine. Using the TestState API, you can test the following: • A state's input and output processing data flow. • An AWS service integration with other AWS services request and response • An HTTP Task request and response To test a state, you can also use the Step Functions console, AWS Command Line Interface (AWS CLI), or the SDK. The TestState API assumes an IAM role which must contain the required IAM permissions for the resources your state accesses. For information about the permissions a state might need, see IAM permissions for using TestState API. Topics • Considerations about using the TestState API • Using inspection levels in TestState API • IAM permissions for using TestState API • Testing a state (Console) • Testing a state using AWS CLI • Testing and debugging input and output data flow Considerations about using the TestState API Using the TestState API, you can test only one state at a time. The states that you can test include the following: • All Task types, except Activities • Pass workflow state • Wait workflow state • Choice workflow state Testing with TestState 932 AWS Step Functions • Succeed workflow state • Fail workflow state Developer Guide While using the TestState API, keep in mind the following considerations. • The TestState API doesn't include support for the following: • Task workflow state states that use the following resource types: • Activity • Service integration patterns of type .sync or .waitForTaskToken • Parallel workflow state state • Map workflow state state • A test can run for up to five minutes. If a test exceeds this duration, it fails with the States.Timeout error. Using inspection levels in TestState API To test a state using the TestState API, you provide the definition of that state. The test then returns an output. For each
|
step-functions-dg-254
|
step-functions-dg.pdf
| 254 |
API, keep in mind the following considerations. • The TestState API doesn't include support for the following: • Task workflow state states that use the following resource types: • Activity • Service integration patterns of type .sync or .waitForTaskToken • Parallel workflow state state • Map workflow state state • A test can run for up to five minutes. If a test exceeds this duration, it fails with the States.Timeout error. Using inspection levels in TestState API To test a state using the TestState API, you provide the definition of that state. The test then returns an output. For each state, you can specify the amount of detail you want to view in the test results. These details provide additional information about the state you're testing. For example, if you've used any input and output data processing filters, such as InputPath or ResultPath in a state, you can view the intermediate and final data processing results. Step Functions provides the following levels to specify the details you want to view: • INFO • DEBUG • TRACE All these levels also return the status and nextState fields. status indicates the status of the state execution. For example, SUCCEEDED, FAILED, RETRIABLE, and CAUGHT_ERROR. nextState indicates the name of the next state to transition to. If you haven't defined a next state in your definition, this field returns an empty value. For information about testing a state using these inspection levels in the Step Functions console and AWS CLI, see Testing a state (Console) and Testing a state using AWS CLI. Using inspection levels in TestState API 933 AWS Step Functions INFO inspectionLevel Developer Guide If the test succeeds, this level shows the state output. If the test fails, this level shows the error output. By default, Step Functions sets Inspection level to INFO if you don't specify a level. Example of test with INFO level that succeeds The following image shows a test for a Pass state that succeeds. The Inspection level for this state is set to INFO and the output for the state appears in the Output tab. Using inspection levels in TestState API 934 AWS Step Functions Developer Guide Example of test with INFO level that fails The following image shows a test that failed for a Task state when the Inspection level is set to INFO. The Output tab shows the error output that includes the error name and a detailed explanation of the cause for that error. DEBUG inspectionLevel If the test succeeds, this level shows the state output and the result of input and output data processing. Using inspection levels in TestState API 935 AWS Step Functions Developer Guide If the test fails, this level shows the error output. This level shows the intermediate data processing results up to the point of failure. For example, say that you tested a Task state that invokes a Lambda function. Imagine that you had applied the InputPath, Parameters, Specifying state output using ResultPath in Step Functions, and Filtering state output using OutputPath filters to the Task state. Say that the invocation failed. In this case, the DEBUG level shows data processing results based on the application of the filters in the following order: • input – Raw state input • afterInputPath – Input after Step Functions applies the InputPath filter. • afterParameters – The effective input after Step Functions applies the Parameters filter. The diagnostic information available in this level can help you troubleshoot issues related to a service integration or input and output data processing flow that you might have defined. Example of test with DEBUG level that succeeds The following image shows a test for a Pass state that succeeds. The Inspection level for this state is set to DEBUG. The Input/output processing tab in the following image shows the result of the application of Parameters on the input provided for this state. Using inspection levels in TestState API 936 AWS Step Functions Developer Guide Example of test with DEBUG level that fails The following image shows a test that failed for a Task state when the Inspection level is set to DEBUG. The Input/output processing tab in the following image shows the input and output data processing result for the state up to the point of its failure. Using inspection levels in TestState API 937 AWS Step Functions Developer Guide TRACE inspectionLevel Step Functions provides the TRACE level to test an HTTP Task. This level returns information about the HTTP request that Step Functions makes and response that a HTTPS API returns. The response might contain information, such as headers and request body. In addition, you can view the state output and result of input and output data processing in this level. If the test fails, this level shows the error output. This level is only
|
step-functions-dg-255
|
step-functions-dg.pdf
| 255 |
processing result for the state up to the point of its failure. Using inspection levels in TestState API 937 AWS Step Functions Developer Guide TRACE inspectionLevel Step Functions provides the TRACE level to test an HTTP Task. This level returns information about the HTTP request that Step Functions makes and response that a HTTPS API returns. The response might contain information, such as headers and request body. In addition, you can view the state output and result of input and output data processing in this level. If the test fails, this level shows the error output. This level is only applicable for HTTP Task. Step Functions throws an error if you use this level for other state types. Using inspection levels in TestState API 938 AWS Step Functions Developer Guide When you set the Inspection level to TRACE, you can also view secrets included in the EventBridge connection. To do this, you must set the revealSecrets parameter to true in the TestState API. In addition, you must make sure that the IAM user that calls the TestState API has permission for the states:RevealSecrets action. For an example of IAM policy that sets the states:RevealSecrets permission, see IAM permissions for using TestState API. Without this permission, Step Functions throws an access denied error. If you set the revealSecrets parameter to false, Step Functions omits all secrets in the HTTP request and response data. Example of test with TRACE level that succeeds The following image shows a test for an HTTP Task that succeeds. The Inspection level for this state is set to TRACE. The HTTP request & response tab in the following image shows the result of the HTTPS API call. Using inspection levels in TestState API 939 AWS Step Functions Developer Guide IAM permissions for using TestState API The IAM user that calls the TestState API must have permissions to perform the states:TestState and iam:PassRole actions. In addition, if you set the revealSecrets parameter to true, you must make sure that the IAM user has permissions to perform the states:RevealSecrets action. Without this permission, Step Functions throws an access denied error. You must also make sure that your execution role contains the required IAM permissions for the resources your state is accessing. For information about the permissions a state might need, see Managing execution roles. IAM permissions for using TestState API 940 AWS Step Functions Developer Guide The following IAM policy example sets the states:TestState, iam:PassRole, and states:RevealSecrets permissions. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "states:TestState", "states:RevealSecrets", "iam:PassRole" ], "Resource": "*" } ] } Testing a state (Console) You can test a state in the console and check the state output or input and output data processing flow. For an HTTP Task, you can test the raw HTTP request and response. To test a state 1. Open the Step Functions console. 2. Choose Create state machine to start creating a state machine or choose an existing state machine. 3. In the Design mode of Workflow Studio, choose a state that you want to test. 4. Choose Test state in the Inspector panel panel of Workflow Studio. 5. In the Test state dialog box, do the following: a. b. c. For Execution role, choose an execution role to test the state. Make sure that you have the required IAM permissions for the state that you want to test. (Optional) Provide any JSON input that your selected state needs for the test. For Inspection level, select one of the following options based on the values you want to view: Testing a state (Console) 941 AWS Step Functions Developer Guide • INFO – Shows the state output in the Output tab if the test succeeds. If the test fails, INFO shows the error output, which includes the error name and a detailed explanation of the cause for that error. By default, Step Functions sets Inspection level to INFO if you don't select a level. • DEBUG – Shows the state output and the result of input and output data processing if the test succeeds. If the test fails, DEBUG shows the error output, which includes the error name and a detailed explanation of the cause for that error. • TRACE – Shows the raw HTTP request and response, and is useful for verifying headers, query parameters, and other API-specific details. This option is only available for the HTTP Task. Optionally, you can choose to select Reveal secrets. In combination with TRACE, this setting lets you see the sensitive data that the EventBridge connection inserts, such as API keys. The IAM user identity that you use to access the console must have permission to perform the states:RevealSecrets action. Without this permission, Step Functions throws an access denied error when you start the test. For an example of an IAM policy
|
step-functions-dg-256
|
step-functions-dg.pdf
| 256 |
TRACE – Shows the raw HTTP request and response, and is useful for verifying headers, query parameters, and other API-specific details. This option is only available for the HTTP Task. Optionally, you can choose to select Reveal secrets. In combination with TRACE, this setting lets you see the sensitive data that the EventBridge connection inserts, such as API keys. The IAM user identity that you use to access the console must have permission to perform the states:RevealSecrets action. Without this permission, Step Functions throws an access denied error when you start the test. For an example of an IAM policy that sets the states:RevealSecrets permission, see IAM permissions for using TestState API. d. Choose Start test. Testing a state using AWS CLI You can test a supported state using the TestState API in the AWS CLI. This API accepts the definition of a state and executes it. For each state, you can specify the amount of detail you want to view in the test results. These details provide additional information about the state's execution, including its input and output data processing result and HTTP request and response information. The following examples showcase the different inspection levels you can specify for the TestState API. Remember to replace the italicized text with your resource-specific information. This section contains the following examples that describe how you can use the different inspection levels that Step Functions provides in the AWS CLI: • Using INFO inspectionLevel • Using DEBUG inspectionLevel Testing a state using AWS CLI 942 AWS Step Functions • Using TRACE inspectionLevel Developer Guide • Using jq utility in AWS CLI to filter and print the HTTP response that TestState API returns Example 1: Using INFO inspectionLevel to test a Choice state To test a state using the INFO inspectionLevel in the AWS CLI, run the test-state command as shown in the following example. aws stepfunctions test-state \ --definition '{"Type": "Choice", "Choices": [{"Variable": "$.number", "NumericEquals": 1, "Next": "Equals 1"}, {"Variable": "$.number", "NumericEquals": 2, "Next": "Equals 2"}], "Default": "No Match"}' \ --role-arn arn:aws:iam::account-id:role/myRole \ --input '{"number": 2}' This example uses a Choice state to determine the execution path for the state based on the numeric input you provide. By default, Step Functions sets the inspectionLevel to INFO if you don't set a level. Step Functions returns the following output. { "output": "{\"number\": 2}", "nextState": "Equals 2", "status": "SUCCEEDED" } Example 2: Using DEBUG inspectionLevel to debug input and output data processing in a Pass state To test a state using the DEBUG inspectionLevel in the AWS CLI, run the test-state command as shown in the following example. aws stepfunctions test-state \ --definition '{"Type": "Pass", "InputPath": "$.payload", "Parameters": {"data": 1}, "ResultPath": "$.result", "OutputPath": "$.result.data", "Next": "Another State"}' \ --role-arn arn:aws:iam::account-id:role/myRole \ --input '{"payload": {"foo": "bar"}}' \ --inspection-level DEBUG Testing a state using AWS CLI 943 AWS Step Functions Developer Guide This example uses a Pass workflow state state to showcase how Step Functions filters and manipulates input JSON data using the input and output data processing filters. This example uses these filters: InputPath, Parameters, Specifying state output using ResultPath in Step Functions, and Filtering state output using OutputPath. Step Functions returns the following output. { "output": "1", "inspectionData": { "input": "{\"payload\": {\"foo\": \"bar\"}}", "afterInputPath": "{\"foo\":\"bar\"}", "afterParameters": "{\"data\":1}", "afterResultSelector": "{\"data\":1}", "afterResultPath": "{\"payload\":{\"foo\":\"bar\"},\"result\":{\"data\":1}}" }, "nextState": "Another State", "status": "SUCCEEDED" } Example 3: Using TRACE inspectionLevel and revealSecrets to inspect the HTTP request sent to a HTTPS API To test an HTTP Task using the TRACE inspectionLevel along with the revealSecrets parameter in the AWS CLI, run the test-state command as shown in the following example. aws stepfunctions test-state \ --definition '{"Type": "Task", "Resource": "arn:aws:states:::http:invoke", "Parameters": {"Method": "GET", "Authentication": {"ConnectionArn": "arn:aws:events:region:account- id:connection/MyConnection/0000000-0000-0000-0000-000000000000"}, "ApiEndpoint": "https://httpbin.org/get", "Headers": {"definitionHeader": "h1"}, "RequestBody": {"message": "Hello from Step Functions!"}, "QueryParameters": {"queryParam": "q1"}}, "End": true}' \ --role-arn arn:aws:iam::account-id:role/myRole \ --inspection-level TRACE \ --reveal-secrets This example tests if the HTTP Task calls the specified HTTPS API, https://httpbin.org/. It also shows the HTTP request and response data for the API call. Testing a state using AWS CLI 944 AWS Step Functions Developer Guide { "output": "{\"Headers\":{\"date\":[\"Tue, 21 Nov 2023 00:06:17 GMT\"], \"access-control-allow-origin\":[\"*\"],\"content-length\":[\"620\"],\"server\": [\"gunicorn/19.9.0\"],\"access-control-allow-credentials\":[\"true\"],\"content- type\":[\"application/json\"]},\"ResponseBody\":{\"args\":{\"QueryParam1\": \"QueryParamValue1\",\"queryParam\":\"q1\"},\"headers\":{\"Authorization \":\"Basic XXXXXXXX\",\"Content-Type\":\"application/json; charset=UTF-8\", \"Customheader1\":\"CustomHeaderValue1\",\"Definitionheader\":\"h1\",\"Host\": \"httpbin.org\",\"Range\":\"bytes=0-262144\",\"Transfer-Encoding\":\"chunked\", \"User-Agent\":\"Amazon|StepFunctions|HttpInvoke|region\",\"X-Amzn-Trace-Id\": \"Root=1-0000000-0000-0000-0000-000000000000\"},\"origin\":\"12.34.567.891\",\"url\": \"https://httpbin.org/get?queryParam=q1&QueryParam1=QueryParamValue1\"},\"StatusCode \":200,\"StatusText\":\"OK\"}", "inspectionData": { "input": "{}", "afterInputPath": "{}", "afterParameters": "{\"Method\":\"GET\",\"Authentication\":{\"ConnectionArn \":\"arn:aws:events:region:account-id:connection/foo/a59c10f0-a315-4c1f- be6a-559b9a0c6250\"},\"ApiEndpoint\":\"https://httpbin.org/get\",\"Headers\": {\"definitionHeader\":\"h1\"},\"RequestBody\":{\"message\":\"Hello from Step Functions! \"},\"QueryParameters\":{\"queryParam\":\"q1\"}}", "result": "{\"Headers\":{\"date\":[\"Tue, 21 Nov 2023 00:06:17 GMT\"], \"access-control-allow-origin\":[\"*\"],\"content-length\":[\"620\"],\"server\": [\"gunicorn/19.9.0\"],\"access-control-allow-credentials\":[\"true\"],\"content- type\":[\"application/json\"]},\"ResponseBody\":{\"args\":{\"QueryParam1\": \"QueryParamValue1\",\"queryParam\":\"q1\"},\"headers\":{\"Authorization \":\"Basic XXXXXXXX\",\"Content-Type\":\"application/json; charset=UTF-8\", \"Customheader1\":\"CustomHeaderValue1\",\"Definitionheader\":\"h1\",\"Host\": \"httpbin.org\",\"Range\":\"bytes=0-262144\",\"Transfer-Encoding\":\"chunked\", \"User-Agent\":\"Amazon|StepFunctions|HttpInvoke|region\",\"X-Amzn-Trace-Id\": \"Root=1-0000000-0000-0000-0000-000000000000\"},\"origin\":\"12.34.567.891\",\"url\": \"https://httpbin.org/get?queryParam=q1&QueryParam1=QueryParamValue1\"},\"StatusCode \":200,\"StatusText\":\"OK\"}", "afterResultSelector": "{\"Headers\":{\"date\":[\"Tue, 21 Nov 2023 00:06:17 GMT\"],\"access-control-allow-origin\":[\"*\"],\"content-length\": [\"620\"],\"server\":[\"gunicorn/19.9.0\"],\"access-control-allow-credentials \":[\"true\"],\"content-type\":[\"application/json\"]},\"ResponseBody\":{\"args \":{\"QueryParam1\":\"QueryParamValue1\",\"queryParam\":\"q1\"},\"headers\": {\"Authorization\":\"Basic XXXXXXXX\",\"Content-Type\":\"application/json; charset=UTF-8\",\"Customheader1\":\"CustomHeaderValue1\",\"Definitionheader\":\"h1\", \"Host\":\"httpbin.org\",\"Range\":\"bytes=0-262144\",\"Transfer-Encoding\":\"chunked \",\"User-Agent\":\"Amazon|StepFunctions|HttpInvoke|region\",\"X-Amzn-Trace-Id\": \"Root=1-0000000-0000-0000-0000-000000000000\"},\"origin\":\"12.34.567.891\",\"url\": Testing a state using AWS CLI 945 AWS Step Functions Developer Guide \"https://httpbin.org/get?queryParam=q1&QueryParam1=QueryParamValue1\"},\"StatusCode \":200,\"StatusText\":\"OK\"}", "afterResultPath": "{\"Headers\":{\"date\":[\"Tue, 21 Nov 2023 00:06:17 GMT\"],\"access-control-allow-origin\":[\"*\"],\"content-length\":[\"620\"], \"server\":[\"gunicorn/19.9.0\"],\"access-control-allow-credentials\":[\"true\"], \"content-type\":[\"application/json\"]},\"ResponseBody\":{\"args\":{\"QueryParam1\": \"QueryParamValue1\",\"queryParam\":\"q1\"},\"headers\":{\"Authorization\": \"Basic XXXXXXXX\",\"Content-Type\":\"application/json; charset=UTF-8\", \"Customheader1\":\"CustomHeaderValue1\",\"Definitionheader\":\"h1\",\"Host\": \"httpbin.org\",\"Range\":\"bytes=0-262144\",\"Transfer-Encoding\":\"chunked\", \"User-Agent\":\"Amazon|StepFunctions|HttpInvoke|region\",\"X-Amzn-Trace-Id\": \"Root=1-0000000-0000-0000-0000-000000000000\"},\"origin\":\"12.34.567.891\",\"url\": \"https://httpbin.org/get?queryParam=q1&QueryParam1=QueryParamValue1\"},\"StatusCode \":200,\"StatusText\":\"OK\"}", "request": { "protocol": "https", "method": "GET", "url": "https://httpbin.org/get? queryParam=q1&QueryParam1=QueryParamValue1", "headers": "[definitionHeader: h1, Authorization: Basic XXXXXXXX, CustomHeader1: CustomHeaderValue1, User-Agent: Amazon|StepFunctions|HttpInvoke|region,
|
step-functions-dg-257
|
step-functions-dg.pdf
| 257 |
"{}", "afterInputPath": "{}", "afterParameters": "{\"Method\":\"GET\",\"Authentication\":{\"ConnectionArn \":\"arn:aws:events:region:account-id:connection/foo/a59c10f0-a315-4c1f- be6a-559b9a0c6250\"},\"ApiEndpoint\":\"https://httpbin.org/get\",\"Headers\": {\"definitionHeader\":\"h1\"},\"RequestBody\":{\"message\":\"Hello from Step Functions! \"},\"QueryParameters\":{\"queryParam\":\"q1\"}}", "result": "{\"Headers\":{\"date\":[\"Tue, 21 Nov 2023 00:06:17 GMT\"], \"access-control-allow-origin\":[\"*\"],\"content-length\":[\"620\"],\"server\": [\"gunicorn/19.9.0\"],\"access-control-allow-credentials\":[\"true\"],\"content- type\":[\"application/json\"]},\"ResponseBody\":{\"args\":{\"QueryParam1\": \"QueryParamValue1\",\"queryParam\":\"q1\"},\"headers\":{\"Authorization \":\"Basic XXXXXXXX\",\"Content-Type\":\"application/json; charset=UTF-8\", \"Customheader1\":\"CustomHeaderValue1\",\"Definitionheader\":\"h1\",\"Host\": \"httpbin.org\",\"Range\":\"bytes=0-262144\",\"Transfer-Encoding\":\"chunked\", \"User-Agent\":\"Amazon|StepFunctions|HttpInvoke|region\",\"X-Amzn-Trace-Id\": \"Root=1-0000000-0000-0000-0000-000000000000\"},\"origin\":\"12.34.567.891\",\"url\": \"https://httpbin.org/get?queryParam=q1&QueryParam1=QueryParamValue1\"},\"StatusCode \":200,\"StatusText\":\"OK\"}", "afterResultSelector": "{\"Headers\":{\"date\":[\"Tue, 21 Nov 2023 00:06:17 GMT\"],\"access-control-allow-origin\":[\"*\"],\"content-length\": [\"620\"],\"server\":[\"gunicorn/19.9.0\"],\"access-control-allow-credentials \":[\"true\"],\"content-type\":[\"application/json\"]},\"ResponseBody\":{\"args \":{\"QueryParam1\":\"QueryParamValue1\",\"queryParam\":\"q1\"},\"headers\": {\"Authorization\":\"Basic XXXXXXXX\",\"Content-Type\":\"application/json; charset=UTF-8\",\"Customheader1\":\"CustomHeaderValue1\",\"Definitionheader\":\"h1\", \"Host\":\"httpbin.org\",\"Range\":\"bytes=0-262144\",\"Transfer-Encoding\":\"chunked \",\"User-Agent\":\"Amazon|StepFunctions|HttpInvoke|region\",\"X-Amzn-Trace-Id\": \"Root=1-0000000-0000-0000-0000-000000000000\"},\"origin\":\"12.34.567.891\",\"url\": Testing a state using AWS CLI 945 AWS Step Functions Developer Guide \"https://httpbin.org/get?queryParam=q1&QueryParam1=QueryParamValue1\"},\"StatusCode \":200,\"StatusText\":\"OK\"}", "afterResultPath": "{\"Headers\":{\"date\":[\"Tue, 21 Nov 2023 00:06:17 GMT\"],\"access-control-allow-origin\":[\"*\"],\"content-length\":[\"620\"], \"server\":[\"gunicorn/19.9.0\"],\"access-control-allow-credentials\":[\"true\"], \"content-type\":[\"application/json\"]},\"ResponseBody\":{\"args\":{\"QueryParam1\": \"QueryParamValue1\",\"queryParam\":\"q1\"},\"headers\":{\"Authorization\": \"Basic XXXXXXXX\",\"Content-Type\":\"application/json; charset=UTF-8\", \"Customheader1\":\"CustomHeaderValue1\",\"Definitionheader\":\"h1\",\"Host\": \"httpbin.org\",\"Range\":\"bytes=0-262144\",\"Transfer-Encoding\":\"chunked\", \"User-Agent\":\"Amazon|StepFunctions|HttpInvoke|region\",\"X-Amzn-Trace-Id\": \"Root=1-0000000-0000-0000-0000-000000000000\"},\"origin\":\"12.34.567.891\",\"url\": \"https://httpbin.org/get?queryParam=q1&QueryParam1=QueryParamValue1\"},\"StatusCode \":200,\"StatusText\":\"OK\"}", "request": { "protocol": "https", "method": "GET", "url": "https://httpbin.org/get? queryParam=q1&QueryParam1=QueryParamValue1", "headers": "[definitionHeader: h1, Authorization: Basic XXXXXXXX, CustomHeader1: CustomHeaderValue1, User-Agent: Amazon|StepFunctions|HttpInvoke|region, Range: bytes=0-262144]", "body": "{\"message\":\"Hello from Step Functions!\",\"BodyKey1\": \"BodyValue1\"}" }, "response": { "protocol": "https", "statusCode": "200", "statusMessage": "OK", "headers": "[date: Tue, 21 Nov 2023 00:06:17 GMT, content-type: application/json, content-length: 620, server: gunicorn/19.9.0, access-control-allow- origin: *, access-control-allow-credentials: true]", "body": "{\n \"args\": {\n \"QueryParam1\": \"QueryParamValue1\", \n \"queryParam\": \"q1\"\n }, \n \"headers\": {\n \"Authorization \": \"Basic XXXXXXXX\", \n \"Content-Type\": \"application/json; charset=UTF-8\", \n \"Customheader1\": \"CustomHeaderValue1\", \n \"Definitionheader\": \"h1\", \n \"Host\": \"httpbin.org\", \n \"Range\": \"bytes=0-262144\", \n \"Transfer-Encoding\": \"chunked\", \n \"User-Agent\": \"Amazon|StepFunctions|HttpInvoke|region\", \n \"X-Amzn-Trace-Id\": \"Root=1-0000000-0000-0000-0000-000000000000\"\n }, \n \"origin\": \"12.34.567.891\", \n \"url\": \"https://httpbin.org/get? queryParam=q1&QueryParam1=QueryParamValue1\"\n}\n" } }, Testing a state using AWS CLI 946 AWS Step Functions "status": "SUCCEEDED" } Developer Guide Example 4: Using jq utility to filter and print the response that TestState API returns The TestState API returns JSON data as escaped strings in its response. The following AWS CLI example extends Example 3 and uses the jq utility to filter and print the HTTP response that the TestState API returns in a human-readable format. For information about jq and its installation instructions, see jq on GitHub. aws stepfunctions test-state \ --definition '{"Type": "Task", "Resource": "arn:aws:states:::http:invoke", "Parameters": {"Method": "GET", "Authentication": {"ConnectionArn": "arn:aws:events:region:account- id:connection/MyConnection/0000000-0000-0000-0000-000000000000"}, "ApiEndpoint": "https://httpbin.org/get", "Headers": {"definitionHeader": "h1"}, "RequestBody": {"message": "Hello from Step Functions!"}, "QueryParameters": {"queryParam": "q1"}}, "End": true}' \ --role-arn arn:aws:iam::account-id:role/myRole \ --inspection-level TRACE \ --reveal-secrets \ | jq '.inspectionData.response.body | fromjson' The following example shows the output returned in a human-readable format. { "args": { "QueryParam1": "QueryParamValue1", "queryParam": "q1" }, "headers": { "Authorization": "Basic XXXXXXXX", "Content-Type": "application/json; charset=UTF-8", "Customheader1": "CustomHeaderValue1", "Definitionheader": "h1", "Host": "httpbin.org", "Range": "bytes=0-262144", "Transfer-Encoding": "chunked", "User-Agent": "Amazon|StepFunctions|HttpInvoke|region", "X-Amzn-Trace-Id": "Root=1-0000000-0000-0000-0000-000000000000" Testing a state using AWS CLI 947 AWS Step Functions }, Developer Guide "origin": "12.34.567.891", "url": "https://httpbin.org/get?queryParam=q1&QueryParam1=QueryParamValue1" } Testing and debugging input and output data flow The TestState API is helpful for testing and debugging the data that flows through your workflow. This section provides some key concepts and explains how to use the TestState for this purpose. Key concepts In Step Functions, the process of filtering and manipulating JSON data as it passes through the states in your state machine is called input and output processing. For information about how this works, see Processing input and output in Step Functions. All the state types in the Amazon States Language (ASL) (Task, Parallel, Map, Pass, Wait, Choice, Succeed, and Fail) share a set of common fields for filtering and manipulating the JSON data that passes through them. These fields are: InputPath, Parameters, ResultSelector, Specifying state output using ResultPath in Step Functions, and Filtering state output using OutputPath. Support for each field varies across states. At runtime, Step Functions applies each field in a specific order. The following diagram shows the order in which these fields are applied to the data inside a Task state: Testing and debugging input and output data flow 948 AWS Step Functions Developer Guide Testing and debugging input and output data flow 949 AWS Step Functions Developer Guide The following list describes the order of application of the input and output processing fields shown in the diagram. 1. State input is the JSON data passed to the current state from a previous state. 2. InputPath filters a portion of the raw state input. 3. Parameters configures the set of values to pass to the Task. 4. The task performs work and returns a result. 5. ResultSelector selects a set of values to keep from the task result. 6. Specifying state output using ResultPath in Step Functions combines the result with the raw state input, or replaces the result with it. 7. Filtering state output using OutputPath filters a portion of the output to pass along to the next state. 8. State output is the JSON data passed from the current state to the next state. These input and output processing fields are optional. If you don’t use any of these fields in your state definition, the task will consume the raw state input, and return the task result as the state output. Using TestState to inspect input and output processing When you call the TestState API and set the inspectionLevel parameter to DEBUG, the API response includes an object called inspectionData. This object contains fields to help you inspect how data was filtered or manipulated within the state
|
step-functions-dg-258
|
step-functions-dg.pdf
| 258 |
state. 8. State output is the JSON data passed from the current state to the next state. These input and output processing fields are optional. If you don’t use any of these fields in your state definition, the task will consume the raw state input, and return the task result as the state output. Using TestState to inspect input and output processing When you call the TestState API and set the inspectionLevel parameter to DEBUG, the API response includes an object called inspectionData. This object contains fields to help you inspect how data was filtered or manipulated within the state when it was executed. The following example shows the inspectionData object for a Task state. "inspectionData": { "input": string, "afterInputPath": string, "afterParameters": string, "result": string, "afterResultSelector": string, "afterResultPath": string, "output": string } In this example, each field that contains the after prefix, shows the data after a particular field was applied. For example, afterInputPath shows the effect of applying the InputPath Testing and debugging input and output data flow 950 AWS Step Functions Developer Guide field to filter the raw state input. The following diagram maps each ASL definition field to its corresponding field in the inspectionData object: For examples of using the TestState API to debug input and output processing, see the following: • Testing a state using the DEBUG inspection level in the Step Functions console • Testing a state using the DEBUG inspection level in the AWS CLI Testing and debugging input and output data flow 951 AWS Step Functions Developer Guide Testing state machines with Step Functions Local (unsupported) Step Functions Local is unsupported Step Functions Local does not provide feature parity and is unsupported. You might consider third party solutions that emulate Step Functions for testing purposes. With AWS Step Functions Local, a downloadable version of Step Functions, you can test applications with Step Functions running in your own development environment. When running Step Functions Local, you can use one of the following ways to invoke service integrations: • Configuring local endpoints for AWS Lambda and other services. • Making calls directly to an AWS service from Step Functions Local. • Mocking the response from service integrations. AWS Step Functions Local is available as a JAR package or a self-contained Docker image that runs on Microsoft Windows, Linux, macOS, and other platforms that support Java or Docker. Warning You should only use Step Functions Local for testing and never to process sensitive information. Topics • Setting Up Step Functions Local (Downloadable Version) in Docker • Setting Up Step Functions Local (Downloadable Version) - Java Version • Setting Configuration Options for Step Functions Local • Running Step Functions Local on Your Computer • Tutorial: Testing workflows using Step Functions and AWS SAM CLI Local • Using mocked service integrations for testing in Step Functions Local Step Functions Local (unsupported) 952 AWS Step Functions Developer Guide Setting Up Step Functions Local (Downloadable Version) in Docker The Step Functions Local Docker image enables you to get started with Step Functions Local quickly by using a Docker image with all the needed dependencies. The Docker image enables you to include Step Functions Local in your containerized builds and as part of your continuous integration testing. To get the Docker image for Step Functions Local, see https://hub.docker.com/r/amazon/aws- stepfunctions-local, or enter the following Docker pull command. docker pull amazon/aws-stepfunctions-local To start the downloadable version of Step Functions on Docker, run the following Docker run command docker run -p 8083:8083 amazon/aws-stepfunctions-local To interact with AWS Lambda or other supported services, you need to configure your credentials and other configuration options first. For more information, see the following topics: • Setting Configuration Options for Step Functions Local • Credentials and configuration for Docker Setting Up Step Functions Local (Downloadable Version) - Java Version The downloadable version of AWS Step Functions is provided as an executable JAR file and as a Docker image. The Java application runs on Windows, Linux, macOS, and other platforms that support Java. In addition to Java, you need to install the AWS Command Line Interface (AWS CLI). For information about installing and configuring the AWS CLI, see the AWS Command Line Interface User Guide. To set up and run Step Functions on your computer 1. Download Step Functions using the following links. Download Links Checksum .tar.gz .tar.gz.md5 Setting Up Step Functions Local and Docker 953 AWS Step Functions Developer Guide Download Links Checksum .zip .zip.md5 2. 3. Extract the .zip file. Test the download and view version information. $ java -jar StepFunctionsLocal.jar -v Step Function Local Version: 2.0.0 Build: 2024-05-18 4. (Optional) View a listing of available commands. $ java -jar StepFunctionsLocal.jar -h 5. To start Step Functions on your computer, open a command prompt, navigate to the directory where you extracted StepFunctionsLocal.jar, and enter the following command. java
|
step-functions-dg-259
|
step-functions-dg.pdf
| 259 |
Step Functions on your computer 1. Download Step Functions using the following links. Download Links Checksum .tar.gz .tar.gz.md5 Setting Up Step Functions Local and Docker 953 AWS Step Functions Developer Guide Download Links Checksum .zip .zip.md5 2. 3. Extract the .zip file. Test the download and view version information. $ java -jar StepFunctionsLocal.jar -v Step Function Local Version: 2.0.0 Build: 2024-05-18 4. (Optional) View a listing of available commands. $ java -jar StepFunctionsLocal.jar -h 5. To start Step Functions on your computer, open a command prompt, navigate to the directory where you extracted StepFunctionsLocal.jar, and enter the following command. java -jar StepFunctionsLocal.jar 6. To access Step Functions running locally, use the --endpoint-url parameter. For example, using the AWS CLI, you would specify Step Functions commands as follows: aws stepfunctions --endpoint-url http://localhost:8083 command Note By default, Step Functions Local uses a local test account and credentials, and the AWS Region is set to US East (N. Virginia). To use Step Functions Local with AWS Lambda, or other supported services, you must configure your credentials and Region. If you use Express workflows with Step Functions Local, the execution history will be stored in a log file. It is not logged to CloudWatch Logs. The log file path will be based on the CloudWatch Logs log group ARN provided when you create the local state machine. The log file will be stored in /aws/states/log-group-name/${execution_arn}.log relative to the location where you are running Step Functions Local. For example, if the execution ARN is: Setting Up Step Functions Local - Java Version 954 AWS Step Functions Developer Guide arn:aws:states:region:account-id:express:test:example-ExpressLogGroup- wJalrXUtnFEMI the log file will be: aws/states/log-group-name/arn:aws:states:region:account-id:express:test:example- ExpressLogGroup-wJalrXUtnFEMI.log Setting Configuration Options for Step Functions Local When you start AWS Step Functions Local by using the JAR file, you can set configuration options by using the AWS Command Line Interface (AWS CLI), or by including them in the system environment. For Docker, you must specify these options in a file that you reference when starting Step Functions Local. Configuration Options When you configure the Step Functions Local container to use an override endpoint such as Lambda Endpoint and Batch Endpoint, and make calls to that endpoint, Step Functions Local doesn't use the credentials you specify. Setting these endpoint overrides is optional. Option Account Region Wait Time Scale Lambda Endpoint Batch Endpoint Command Line Environment -account, --aws-account AWS_ACCOUNT_ID -region, --aws-region AWS_DEFAULT_REGION -waitTimeScale, --wait-time- scale WAIT_TIME_SCALE -lambdaEndpoint, --lambda- endpoint LAMBDA_ENDPOINT -batchEndpoint, --batch-e ndpoint BATCH_ENDPOINT Configuring Step Functions Local Options 955 AWS Step Functions Developer Guide Option Command Line Environment DynamoDB Endpoint -dynamoDBEndpoint, -- dynamodb-endpoint DYNAMODB_ENDPOINT ECS Endpoint -ecsEndpoint, --ecs-endpoint ECS_ENDPOINT Glue Endpoint SageMaker Endpoint -glueEndpoint, --glue-en dpoint -sageMakerEndpoint, -- sagemaker-endpoint GLUE_ENDPOINT SAGE_MAKER_ENDPOINT SQS Endpoint -sqsEndpoint, --sqs-endpoint SQS_ENDPOINT SNS Endpoint -snsEndpoint, --sns-endpoint SNS_ENDPOINT Step Functions Endpoint -stepFunctionsEndpoint, -- step-functions-endpoint STEP_FUNCTIONS_ENDPOINT Credentials and configuration for Docker To configure Step Functions Local for Docker, create the following file: aws-stepfunctions- local-credentials.txt. This file contains your credentials and other configuration options. The following can be used as a template when creating the aws-stepfunctions-local-credentials.txt file. AWS_DEFAULT_REGION=AWS_REGION_OF_YOUR_AWS_RESOURCES AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_KEY WAIT_TIME_SCALE=VALUE LAMBDA_ENDPOINT=VALUE BATCH_ENDPOINT=VALUE DYNAMODB_ENDPOINT=VALUE ECS_ENDPOINT=VALUE GLUE_ENDPOINT=VALUE SAGE_MAKER_ENDPOINT=VALUE SQS_ENDPOINT=VALUE SNS_ENDPOINT=VALUE Configuring Step Functions Local Options 956 AWS Step Functions Developer Guide STEP_FUNCTIONS_ENDPOINT=VALUE Once you have configured your credentials and configuration options in aws-stepfunctions- local-credentials.txt, start Step Functions with the following command. docker run -p 8083:8083 --env-file aws-stepfunctions-local-credentials.txt amazon/aws- stepfunctions-local Note It is recommended to use the special DNS name host.docker.internal, which resolves to the internal IP address that the host uses, such as http:// host.docker.internal:8000. For more information, see Docker documentation for Mac and Windows at Networking features in Docker Desktop for Mac and Networking features in Docker Desktop for Windows respectively. Running Step Functions Local on Your Computer Use the local version of Step Functions to configure, develop and test state machines on your computer. Run a HelloWorld state machine locally After you run Step Functions locally with the AWS Command Line Interface (AWS CLI), you can start a state machine execution. 1. Create a state machine from the AWS CLI by escaping out the state machine definition. aws stepfunctions --endpoint-url http://localhost:8083 create-state-machine -- definition "{\ \"Comment\": \"A Hello World example of the Amazon States Language using a Pass state\",\ \"StartAt\": \"HelloWorld\",\ \"States\": {\ \"HelloWorld\": {\ \"Type\": \"Pass\",\ \"End\": true\ }\ Running Step Functions Local 957 AWS Step Functions Developer Guide }}" --name "HelloWorld" --role-arn "arn:aws:iam::012345678901:role/DummyRole" Note The role-arn is not used for Step Functions Local, but you must include it with the proper syntax. You can use the Amazon Resource Name (ARN) from the previous example. If you successfully create the state machine, Step Functions responds with the creation date and the state machine ARN. { "creationDate": 1548454198.202, "stateMachineArn": "arn:aws:states:region:account-id:stateMachine:HelloWorld" } 2. Start an execution using the ARN of the state machine you created. aws stepfunctions --endpoint-url http://localhost:8083 start-execution --state- machine-arn arn:aws:states:region:account-id:stateMachine:HelloWorld Step Functions Local with
|
step-functions-dg-260
|
step-functions-dg.pdf
| 260 |
\"Pass\",\ \"End\": true\ }\ Running Step Functions Local 957 AWS Step Functions Developer Guide }}" --name "HelloWorld" --role-arn "arn:aws:iam::012345678901:role/DummyRole" Note The role-arn is not used for Step Functions Local, but you must include it with the proper syntax. You can use the Amazon Resource Name (ARN) from the previous example. If you successfully create the state machine, Step Functions responds with the creation date and the state machine ARN. { "creationDate": 1548454198.202, "stateMachineArn": "arn:aws:states:region:account-id:stateMachine:HelloWorld" } 2. Start an execution using the ARN of the state machine you created. aws stepfunctions --endpoint-url http://localhost:8083 start-execution --state- machine-arn arn:aws:states:region:account-id:stateMachine:HelloWorld Step Functions Local with AWS SAM CLI Local You can use the local version of Step Functions with a local version of AWS Lambda. To configure this, you must install and configure AWS SAM. For information about configuring and running AWS SAM, see the following: • Set Up AWS SAM • Start AWS SAM CLI Local When Lambda is running on your local system, you can start Step Functions Local. From the directory where you extracted your Step Functions local JAR files, start Step Functions Local and use the --lambda-endpoint parameter to configure the local Lambda endpoint. java -jar StepFunctionsLocal.jar --lambda-endpoint http://127.0.0.1:3001 command Running Step Functions Local 958 AWS Step Functions Developer Guide For more information about running Step Functions Local with AWS Lambda, see Tutorial: Testing workflows using Step Functions and AWS SAM CLI Local. Tutorial: Testing workflows using Step Functions and AWS SAM CLI Local Step Functions Local is unsupported Step Functions Local does not provide feature parity and is unsupported. You might consider third party solutions that emulate Step Functions for testing purposes. With both AWS Step Functions and AWS Lambda running on your local machine, you can test your state machine and Lambda functions without deploying your code to AWS. For more information, see the following topics: • Testing state machines with Step Functions Local (unsupported) • Set Up AWS SAM Step 1: Set Up AWS SAM AWS Serverless Application Model (AWS SAM) CLI Local requires the AWS Command Line Interface, AWS SAM, and Docker to be installed. 1. Install the AWS SAM CLI. Note Before installing the AWS SAM CLI, you need to install the AWS CLI and Docker. See the Prerequisites for installing the AWS SAM CLI. 2. Go through the AWS SAM Quick Start documentation. Be sure to follow the steps to do the following: 1. Initialize the Application 2. Test the Application Locally Tutorial: Testing using Step Functions and AWS SAM CLI Local 959 AWS Step Functions Developer Guide This creates a sam-app directory, and builds an environment that includes a Python-based Hello World Lambda function. Step 2: Test AWS SAM CLI Local Now that you have installed AWS SAM and created the Hello World Lambda function, you can test the function. In the sam-app directory, enter the following command: sam local start-api This launches a local instance of your Lambda function. You should see output similar to the following: 2019-01-31 16:40:27 Found credentials in shared credentials file: ~/.aws/credentials 2019-01-31 16:40:27 Mounting HelloWorldFunction at http://127.0.0.1:3000/hello [GET] 2019-01-31 16:40:27 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template 2019-01-31 16:40:27 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit) Open a browser and enter the following: http://127.0.0.1:3000/hello This will output a response similar to the following: {"message": "hello world", "location": "72.21.198.66"} Enter CTRL+C to end the Lambda API. Step 3: Start AWS SAM CLI Local Now that you've tested that the function works, start AWS SAM CLI Local. In the sam-app directory, enter the following command: sam local start-lambda Tutorial: Testing using Step Functions and AWS SAM CLI Local 960 AWS Step Functions Developer Guide This starts AWS SAM CLI Local and provides the endpoint to use, similar to the following output: 2019-01-29 15:33:32 Found credentials in shared credentials file: ~/.aws/credentials 2019-01-29 15:33:32 Starting the Local Lambda Service. You can now invoke your Lambda Functions defined in your template through the endpoint. 2019-01-29 15:33:32 * Running on http://127.0.0.1:3001/ (Press CTRL+C to quit) Step 4: Start Step Functions Local JAR File If you're using the .jar file version of Step Functions Local, start Step Functions and specify the Lambda endpoint. In the directory where you extracted the .jar files, enter the following command: java -jar StepFunctionsLocal.jar --lambda-endpoint http://localhost:3001 When Step Functions Local starts, it checks the environment, and then the credentials configured in your ~/.aws/credentials file. By default, it starts using a fictitious user ID, and is listed as region us-east-1. 2019-01-29 15:38:06.324: Failed to load credentials from environment because Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or
|
step-functions-dg-261
|
step-functions-dg.pdf
| 261 |
4: Start Step Functions Local JAR File If you're using the .jar file version of Step Functions Local, start Step Functions and specify the Lambda endpoint. In the directory where you extracted the .jar files, enter the following command: java -jar StepFunctionsLocal.jar --lambda-endpoint http://localhost:3001 When Step Functions Local starts, it checks the environment, and then the credentials configured in your ~/.aws/credentials file. By default, it starts using a fictitious user ID, and is listed as region us-east-1. 2019-01-29 15:38:06.324: Failed to load credentials from environment because Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)) 2019-01-29 15:38:06.326: Loaded credentials from profile: default 2019-01-29 15:38:06.326: Starting server on port 8083 with account account-id, region us-east-1 Docker If you're using the Docker version of Step Functions Local, launch Step Functions with the following command: docker run -p 8083:8083 amazon/aws-stepfunctions-local For information about installing the Docker version of Step Functions, see Setting Up Step Functions Local (Downloadable Version) in Docker. Tutorial: Testing using Step Functions and AWS SAM CLI Local 961 AWS Step Functions Note Developer Guide You can specify the endpoint through the command line or by setting environment variables if you launch Step Functions from the .jar file. For the Docker version, you must specify the endpoints and credentials in a text file. See Setting Configuration Options for Step Functions Local. Step 5: Create a State Machine That References Your AWS SAM CLI Local Function After Step Functions Local is running, create a state machine that references the HelloWorldFunction that you initialized in Step 1: Set Up AWS SAM. aws stepfunctions --endpoint http://localhost:8083 create-state-machine --definition "{\ \"Comment\": \"A Hello World example of the Amazon States Language using an AWS Lambda Local function\",\ \"StartAt\": \"HelloWorld\",\ \"States\": {\ \"HelloWorld\": {\ \"Type\": \"Task\",\ \"Resource\": \"arn:aws:lambda:region:account-id:function:HelloWorldFunction\",\ \"End\": true\ }\ }\ }\" --name "HelloWorld" --role-arn "arn:aws:iam::012345678901:role/DummyRole" This will create a state machine and provide an Amazon Resource Name (ARN) that you can use to start an execution. { "creationDate": 1548805711.403, "stateMachineArn": "arn:aws:states:region:account-id:stateMachine:HelloWorld" } Step 6: Start an Execution of Your Local State Machine Once you have created a state machine, start an execution. You'll need to reference the endpoint and state machine ARN when using the following aws stepfunctions command: Tutorial: Testing using Step Functions and AWS SAM CLI Local 962 AWS Step Functions Developer Guide aws stepfunctions --endpoint http://localhost:8083 start-execution --state-machine arn:aws:states:region:account-id:stateMachine:HelloWorld --name test This starts an execution named test of your HelloWorld state machine. { "startDate": 1548810641.52, "executionArn": "arn:aws:states:region:account-id:execution:HelloWorld:test" } Now that Step Functions is running locally, you can interact with it using the AWS CLI. For example, to get information about this execution, use the following command: aws stepfunctions --endpoint http://localhost:8083 describe-execution --execution-arn arn:aws:states:region:account-id:execution:HelloWorld:test Calling describe-execution for an execution provides more complete details, similar to the following output: { "status": "SUCCEEDED", "startDate": 1549056334.073, "name": "test", "executionArn": "arn:aws:states:region:account-id:execution:HelloWorld:test", "stateMachineArn": "arn:aws:states:region:account-id:stateMachine:HelloWorld", "stopDate": 1549056351.276, "output": "{\"statusCode\": 200, \"body\": \"{\\\"message\\\": \\\"hello world\\\", \\\"location\\\": \\\"72.21.198.64\\\"}\"}", "input": "{}" } Using mocked service integrations for testing in Step Functions Local Step Functions Local is unsupported Step Functions Local does not provide feature parity and is unsupported. You might consider third party solutions that emulate Step Functions for testing purposes. Testing with mocked service integrations 963 AWS Step Functions Developer Guide In Step Functions Local, you can test the execution paths of your state machines without actually calling integrated services by using mocked service integrations. To configure your state machines to use mocked service integrations, you create a mock configuration file. In this file, you define the desired output of your service integrations as mocked responses and the executions which use your mocked responses to simulate an execution path as test cases. By providing the mock configuration file to Step Functions Local, you can test service integration calls by running state machines that use the mocked responses specified in the test cases instead of making actual service integration calls. Note If you don't specify mocked service integration responses in the mock configuration file, Step Functions Local will invoke the AWS service integration using the endpoint you configured while setting up Step Functions Local. For information about configuring endpoints for Step Functions Local, see Setting Configuration Options for Step Functions Local. This topic uses several concepts which are defined in the following list: • Mocked Service Integrations - Refers to Task states configured to use mocked responses instead of performing actual service calls. • Mocked Responses - Refers to mock data that Task states can be configured to use. • Test Cases - Refers to state machine executions configured to use mocked service integrations. • Mock Configuration File - Refers to mock configuration file that contains JSON, which defines mocked service integrations, mocked responses, and test cases. Configuring mocked service integrations You can mock any service integration using Step Functions Local. However, Step Functions Local doesn’t
|
step-functions-dg-262
|
step-functions-dg.pdf
| 262 |
which are defined in the following list: • Mocked Service Integrations - Refers to Task states configured to use mocked responses instead of performing actual service calls. • Mocked Responses - Refers to mock data that Task states can be configured to use. • Test Cases - Refers to state machine executions configured to use mocked service integrations. • Mock Configuration File - Refers to mock configuration file that contains JSON, which defines mocked service integrations, mocked responses, and test cases. Configuring mocked service integrations You can mock any service integration using Step Functions Local. However, Step Functions Local doesn’t enforce the mocks to be the same as the real APIs. A mocked Task will never call the service endpoint. If you do not specify a mocked response, a Task will attempt to call the service endpoints. In addition, Step Functions Local will automatically generate a task token when you mock a Task using the .waitForTaskToken. Testing with mocked service integrations 964 AWS Step Functions Developer Guide Step 1: Specify Mocked Service Integrations in a Mock Configuration File You can test Step Functions AWS SDK and optimized service integrations using Step Functions Local. The following image shows the state machine defined in the State machine definition tab: To do this, you must create a mock configuration file containing sections as defined in Mock configuration file structure. 1. Create a file named MockConfigFile.json to configure tests with mocked service integrations. The following example shows a mock configuration file referencing a state machine with two defined states named LambdaState and SQSState. Mock configuration file example The following is an example of a mock configuration file which demonstrates how to mock responses from invoking a Lambda function and sending a message to Amazon SQS. In this example, the LambdaSQSIntegration state machine contains three test cases named HappyPath, RetryPath, and HybridPath which mock the Task states named LambdaState and SQSState. These states use the MockedLambdaSuccess, MockedSQSSuccess, and MockedLambdaRetry mocked service responses. These mocked service responses are defined in the MockedResponses section of the file. { Testing with mocked service integrations 965 AWS Step Functions Developer Guide "StateMachines":{ "LambdaSQSIntegration":{ "TestCases":{ "HappyPath":{ "LambdaState":"MockedLambdaSuccess", "SQSState":"MockedSQSSuccess" }, "RetryPath":{ "LambdaState":"MockedLambdaRetry", "SQSState":"MockedSQSSuccess" }, "HybridPath":{ "LambdaState":"MockedLambdaSuccess" } } } }, "MockedResponses":{ "MockedLambdaSuccess":{ "0":{ "Return":{ "StatusCode":200, "Payload":{ "StatusCode":200, "body":"Hello from Lambda!" } } } }, "LambdaMockedResourceNotReady":{ "0":{ "Throw":{ "Error":"Lambda.ResourceNotReadyException", "Cause":"Lambda resource is not ready." } } }, "MockedSQSSuccess":{ "0":{ "Return":{ "MD5OfMessageBody":"3bcb6e8e-7h85-4375-b0bc-1a59812c6e51", "MessageId":"3bcb6e8e-8b51-4375-b0bc-1a59812c6e51" } } Testing with mocked service integrations 966 AWS Step Functions }, "MockedLambdaRetry":{ "0":{ "Throw":{ Developer Guide "Error":"Lambda.ResourceNotReadyException", "Cause":"Lambda resource is not ready." } }, "1-2":{ "Throw":{ "Error":"Lambda.TimeoutException", "Cause":"Lambda timed out." } }, "3":{ "Return":{ "StatusCode":200, "Payload":{ "StatusCode":200, "body":"Hello from Lambda!" } } } } } } State machine definition The following is an example of a state machine definition called LambdaSQSIntegration, which defines two service integration task states named LambdaState and SQSState. LambdaState contains a retry policy based on States.ALL. { "Comment":"This state machine is called: LambdaSQSIntegration", "StartAt":"LambdaState", "States":{ "LambdaState":{ "Type":"Task", "Resource":"arn:aws:states:::lambda:invoke", "Parameters":{ "Payload.$":"$", "FunctionName":"HelloWorldFunction" Testing with mocked service integrations 967 AWS Step Functions Developer Guide }, "Retry":[ { "ErrorEquals":[ "States.ALL" ], "IntervalSeconds":2, "MaxAttempts":3, "BackoffRate":2 } ], "Next":"SQSState" }, "SQSState":{ "Type":"Task", "Resource":"arn:aws:states:::sqs:sendMessage", "Parameters":{ "QueueUrl":"https://sqs.us-east-1.amazonaws.com/account-id/myQueue", "MessageBody.$":"$" }, "End": true } } } You can run the LambdaSQSIntegration state machine definition referenced in the mock configuration file using one of the following test cases: • HappyPath - This test mocks the output of LambdaState and SQSState using MockedLambdaSuccess and MockedSQSSuccess respectively. • The LambdaState will return the following value: "0":{ "Return":{ "StatusCode":200, "Payload":{ "StatusCode":200, "body":"Hello from Lambda!" } } } Testing with mocked service integrations 968 AWS Step Functions Developer Guide • The SQSState will return the following value: "0":{ "Return":{ "MD5OfMessageBody":"3bcb6e8e-7h85-4375-b0bc-1a59812c6e51", "MessageId":"3bcb6e8e-8b51-4375-b0bc-1a59812c6e51" } } • RetryPath - This test mocks the output of LambdaState and SQSState using MockedLambdaRetry and MockedSQSSuccess respectively. In addition, LambdaState is configured to perform four retry attempts. The mocked responses for these attempts are defined and indexed in the MockedLambdaRetry state. • The initial attempt ends with a task failure containing a cause and error message as shown in the following example: "0":{ "Throw": { "Error": "Lambda.ResourceNotReadyException", "Cause": "Lambda resource is not ready." } } • The first and second retry attempts end with a task failure containing a cause and error message as shown in the following example: "1-2":{ "Throw": { "Error": "Lambda.TimeoutException", "Cause": "Lambda timed out." } } • The third retry attempt ends with a task success containing state result from Payload section in the mocked Lambda response. "3":{ "Return": { "StatusCode": 200, "Payload": { "StatusCode": 200, Testing with mocked service integrations 969 AWS Step Functions Developer Guide "body": "Hello from Lambda!" } } } Note • For states with a retry policy, Step Functions Local will exhaust the retry attempts set in the policy until it receives a success response. This means
|
step-functions-dg-263
|
step-functions-dg.pdf
| 263 |
failure containing a cause and error message as shown in the following example: "1-2":{ "Throw": { "Error": "Lambda.TimeoutException", "Cause": "Lambda timed out." } } • The third retry attempt ends with a task success containing state result from Payload section in the mocked Lambda response. "3":{ "Return": { "StatusCode": 200, "Payload": { "StatusCode": 200, Testing with mocked service integrations 969 AWS Step Functions Developer Guide "body": "Hello from Lambda!" } } } Note • For states with a retry policy, Step Functions Local will exhaust the retry attempts set in the policy until it receives a success response. This means that you must denote mocks for retries with consecutive attempt numbers and should cover all the retry attempts before returning a success response. • If you do not specify a mocked response for a specific retry attempt, for example, retry "3", the state machine execution will fail. • HybridPath - This test mocks the output of LambdaState. After LambdaState runs successfully and receives mocked data as a response, SQSState performs an actual service call to the resource specified in production. For information about how to start test executions with mocked service integrations, see Step 3: Run Mocked Service Integration Tests. 2. Make sure that the mocked responses' structure conforms to the structure of actual service responses you receive when you make integrated service calls. For information about the structural requirements for mocked responses, see Configuring mocked service integrations. In the previous example mock configuration file, the mocked responses defined in MockedLambdaSuccess and MockedLambdaRetry conform to the structure of actual responses that are returned from calling HelloFromLambda. Important AWS service responses can vary in structure between different services. Step Functions Local doesn't validate if mocked response structures conform to actual service response structures. You must ensure that your mocked responses conform to actual responses before testing. To review the structure of service responses, you can either perform the actual service calls using Step Functions or view the documentation for those services. Testing with mocked service integrations 970 AWS Step Functions Developer Guide Step 2: Provide the Mock Configuration File to Step Functions Local You can provide the mock configuration file to Step Functions Local in one of the following ways: Docker Note If you're using the Docker version of Step Functions Local, you can provide the mock configuration file using an environment variable only. In addition, you must mount the mock configuration file onto the Step Functions Local container at the initial server boot-up. Mount the mock configuration file onto any directory within the Step Functions Local container. Then, set an environment variable named SFN_MOCK_CONFIG that contains the path to the mock configuration file in the container. This method enables the mock configuration file to be named anything as long as the environment variable contains the file path and name. The following command shows the format to start the Docker image. docker run -p 8083:8083 --mount type=bind,readonly,source={absolute path to mock config file},destination=/ home/StepFunctionsLocal/MockConfigFile.json -e SFN_MOCK_CONFIG="/home/StepFunctionsLocal/MockConfigFile.json" amazon/aws- stepfunctions-local The following example uses the command to start the Docker image. docker run -p 8083:8083 --mount type=bind,readonly,source=/Users/admin/Desktop/workplace/ MockConfigFile.json,destination=/home/StepFunctionsLocal/MockConfigFile.json -e SFN_MOCK_CONFIG="/home/StepFunctionsLocal/MockConfigFile.json" amazon/aws- stepfunctions-local JAR File Use one of the following ways to provide the mock configuration file to Step Functions Local: Testing with mocked service integrations 971 AWS Step Functions Developer Guide • Place the mock configuration file in the same directory as Step FunctionsLocal.jar. When using this method, you must name the mock configuration file MockConfigFile.json. • In the session running Step Functions Local, set an environment variable named SFN_MOCK_CONFIG, to the full path of the mock configuration file. This method enables the mock configuration file to be named anything as long as the environment variable contains its file path and name. In the following example, the SFN_MOCK_CONFIG variable is set to point at a mock configuration file named EnvSpecifiedMockConfig.json, located in the /home/workspace directory. export SFN_MOCK_CONFIG="/home/workspace/EnvSpecifiedMockConfig.json" Note • If you do not provide the environment variable SFN_MOCK_CONFIG to Step Functions Local, by default, it will attempt to read a mock configuration file named MockConfigFile.json in the directory from which you launched Step Functions Local. • If you place the mock configuration file in the same directory as Step FunctionsLocal.jar and set the environment variable SFN_MOCK_CONFIG, Step Functions Local will read the file specified by the environment variable. Step 3: Run Mocked Service Integration Tests After you create and provide a mock configuration file to Step Functions Local, run the state machine configured in the mock configuration file using mocked service integrations. Then check the execution results using an API action. 1. Create a state machine based on the previously mentioned definition in the mock configuration file. aws stepfunctions create-state-machine \ --endpoint http://localhost:8083 \ --definition "{\"Comment\":\"Thisstatemachineiscalled:LambdaSQSIntegration \",\"StartAt\":\"LambdaState\",\"States\":{\"LambdaState\":{\"Type\":\"Task\", Testing with mocked service integrations 972 AWS Step Functions Developer Guide \"Resource\":\"arn:aws:states:::lambda:invoke\",\"Parameters\":{\"Payload.$\":\"$ \",\"FunctionName\":\"arn:aws:lambda:region:account-id:function:HelloWorldFunction \"},\"Retry\":[{\"ErrorEquals\":[\"States.ALL\"],\"IntervalSeconds\":2, \"MaxAttempts\":3,\"BackoffRate\":2}],\"Next\":\"SQSState\"},\"SQSState\": {\"Type\":\"Task\",\"Resource\":\"arn:aws:states:::sqs:sendMessage\",\"Parameters \":{\"QueueUrl\":\"https://sqs.us-east-1.amazonaws.com/account-id/myQueue\",
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.