Adding third-party APIs to AWS Step Functions using HTTPS Endpoints

AWS Step Functions has announced support for HTTPS Endpoints. HTTPS Endpoints allows you to directly integrate any third-party API or external SaaS solution like Stripe and Salesforce into your existing workflow without the need for custom code, enabling you to quickly add new features and accelerate the app development process. Also, AWS has a new TestState API that allows you to test each step of the process individually to ensure they work as expected, without having to deploy or execute the state machine.

What is AWS Step Functions?

AWS Step Functions is a fully managed service provided by Amazon Web Services (AWS) that serves as a visual orchestrator, allowing app developers to coordinate and automate the execution of various AWS services and serverless functions into scalable and resilient workflows. This service enhances the efficiency of application development by seamlessly integrating with other AWS services.

However, Before announcing support for HTTPS Endpoints, you would need to use a Lambda function to integrate external APIs that are not AWS-based into your app. Thanks to HTTPS Endpoints, that hassle is out of the way. You can now easily add non-AWS solutions like Stripe for payment and HubSpot for sales and marketing, to boost the functionality of your workflow.

How to get started with HTTPS Endpoints

To learn how to use HTTPS Endpoints on AWS Step Functions, let’s test it on a practical project. We are going to use some external system in our workflow as an HTTP API.

We will do the test with this famous JSON API https://jsonplaceholder.typicode.com/todos

  1. Go to the AWS console and then choose Step Functions.
  1. Now, let’s create a new state machine and select the empty (blank) machine.

After the above task, we will have the screen as shown below.

  1. Now, drag Third Party API from the left pan (call third-party API) to Drag First State here on the right Graph Area.
  1. Once that is done, you will see some changes in the right pan of the AWS step function console.

5. Here in the Right pan, we have to fill in the following details such as the API we want to hit (in our case, it is https://jsonplaceholder.typicode.com/todos), the method (GET, POST, PUT, DELETE), and select connection.

As you do not yet have any connection created, we must create a new connection. (The “test-connection” you see was created by me.)

  1. Click on View Connection to create the connection. You will see the following screen.

Next, click on the Connection Tab.

And then click on the Create Connection button.

I am creating a new connection with the name of test-connection2 with the following details

Towards the bottom, you can see I chose API KEY and entered the API KEY Name and value as test.

Once you click on Create, the connection will be created.

Now, let’s go back to the AWS Step Functions console.

  1. Here, you can see the created connection in drop-down as shown below:
  1. Enter Empty body {} in the Request Body
  2. After that, just click on the Test State button on the top-right of this right pan.
  3. An error message will pop up as below:
  1. The above error says that our AWS STEP functions do not have enough rights to call this API. Therefore, we have to create a role for this in AWS IAM, which will be automatically created once we click on the Create button at the top-right corner of the right pan.
  2. A screen will appear asking for confirmation. Confirm it and you’ll see the following screen:
  1. Simply test it with the Start Execution button. After clicking, a new screen will pop up.

                Click on the Start Execution button again. Then the following screens will appear.

  1. As you can see in the last state TestSucceeded, our Machine has completed its job. We can now go ahead to view the output.
  2. Drop-Down this TestSucceeded and you will see the following output.

Cheers, we have successfully executed an HTTPS Endpoint on the AWS Step Functions. Not too complicated, was it?

That’s the basics, and you could use this same procedure for virtually all APIs. However, if you need help with a unique or more complicated project, I am just a call away. Get in touch now.

Share your love
Pierre Yotti
Pierre Yotti
Articles: 14