DEV Community

GargeeBhatnagar for AWS Community Builders

Posted on

Stack Creation through Step Function Workflow Execution

“ I have to create a stack automatically so I got the way to do it using step function workflow execution. It's very easy to set up using api parameters and cost will be based on the services as s3 and step function.”

AWS Step Functions is a serverless orchestration service that lets you combine AWS Lambda functions and other AWS services to build business-critical applications. Through Step Functions graphical console, you see your application’s workflow as a series of event-driven steps. Step Functions is based on state machines and tasks. A state machine is a workflow. A task is a state in a workflow that represents a single unit of work that another AWS service performs. Each step in a workflow is a state.

In this post, you will get to know how to do stack creation through step function workflow execution. Here I have created s3 bucket, step function and added required permission in the role of step function.

Prerequisites

You’ll need an Amazon Simple Storage Service for this post. Getting started with Amazon Simple Storage Service provides instructions on how to create a bucket in simple storage service. For this blog, I assume that I have a s3 bucket created.

Architecture Overview

Image description
The architecture diagram shows the overall deployment architecture with data flow, aws step function, iam role, cloudformation and s3.

Solution overview

The blog post consist of the following phases:

  1. Create of AWS Step Function with Design Workflow as Cloudformation Create Stack Parameter
  2. Output as Cloudformation and S3 Bucket Creation

I have a s3 bucket with required template file as below →
Image description
Image description

Phase 1: Create of AWS Step Function with Design Workflow as Cloudformation Create Stack Parameter

  1. Open the AWS Step Function console and create a state machine with default parameters. Create a design workflow as choose of cloudformation create stack for creation of cloudformation and its template service config. Also add the IAM required permission to execute the step function successfully. The api parameter contains cloudformation template url as s3 object url of template stored in s3 and capabilities parameter.

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Phase 2: Output as Cloudformation and S3 Bucket Creation

Image description

Image description

Image description

Image description

Image description

Image description

Clean-up

Delete S3 Bucket, Step Function, Iam Role and Cloudformation Stack.

Pricing

I review the pricing and estimated cost of this example.

Cost of S3 = $0.91

Cost of Step Functions = $0 for first 4,000 state transitions = $0.0

Total Cost = $0.91

Summary

In this post, I showed “stack creation through step function workflow execution”.

For more details on AWS Step Functions, Checkout Get started AWS Step Functions, open the AWS Step Functions console. To learn more, read the AWS Step Functions documentation.

Thanks for reading!

Connect with me: Linkedin
Image description

Top comments (0)