Thankful for the AWS Community Builders Program & Building
Brian H. Hough
Posted on December 15, 2023
As the saying goes, "If you want to go fast, go alone. If you want to go far, go together."
Over the last few years, I've benefited so much from being a part of the AWS Community Builders Program - a global community, network, and program. From meeting super talented, smart, and amazing mentors and peers, to receiving exclusive trainings and insights from the teams building the cutting edge technologies powering modern software, I have immense appreciation for this program and everyone who makes it so meaningful.
There are SO many benefits for Community Builders! Here are my top 5:
š Global network
šļø Exclusive trainings
š” Amazing mentors/peers
š£ļø Speaking opportunities
š Super cool swag
If you like building, sharing what you learn, and contributing to a great community, then you should definitely consider applying to the AWS Community Builders program! You can add your name to the waitlist here
Now, since we are in the holiday spirit, we thought it would be fun to create holiday-themed AWS Step Function state machines that model a tree as a thank you to all of the amazing AWS Leaders who make the AWS Community Builders Program so special šš„³ So, let's analyze what goes into a Step Machine and build one together while we thank our incredible AWS Leaders for all that they do...
Step 1: Go to Amazon Step Functions in the console
You will want to search for "Step Functions" in the top search bar. Click on the first AWS service in the dropdown.
This will direct you to the Step Functions page, where you'll either see a list of your currently active Step Functions or nothing listed out in which you'll be able to click that Orange button in the top right to make your very first Step Function state machine on AWS:
Step 2: Pick a template or start from scratch
While we are going to start from scratch by selecting "Blank", there are so many options for very cool Step function flows if you want to architect something more complicated. We are making a tree design, so it is not going to involve that many services or features.
Here's a few of the cool ones:
Distributed Map to process a CSV file in S3: Use Distributed Map to iterate over the rows of a generated CSV file in S3. Each row has order and shipping information. The distributed map item processor iterates over a batch of these rows to detect delayed order using a Lambda function. It then send a message to SQS queue for every delayed order
Generate invoices using Stripe: Use the HTTP task to call Stripe APIs for an invoice-generation workflow. Retrieves a list of customers, summarizes their payment methods, and either generates invoices or reports missing/expired credit cards.
Perform AI prompt-chaining with Amazon Bedrock:
Use AI prompt-chaining with Amazon Bedrock to build high-quality chatbots. By chaining prompts, the LLM can use conversation history to provide more relevant responses.Call a microservice with API Gateway: Make a call to an API Gateway endpoint that fronts an ECS container microservice. (Amazon API Gateway, Amazon ECS)
ETL job in Amazon Redshift: This sample project demonstrates how to use Step Functions and the Amazon Redshift Data API to run an ETL/ELT workflow that loads data into the Amazon Redshift data warehouse.
Tune a machine learning model: Tune hyperparameters of a machine learning model and batch transform a test dataset (Amazon SageMaker, AWS Lambda, Amazon S3)
... The list just truly goes on from there.
Step 3: Setup your Step Function workspace for success
When you create your first state machine, there will be 2 main views to develop within:
- A drag-and-drop UI: this view is helpful to search for various services and simply add them as steps into your state machine.
- A JSON editor: this is the view I prefer the most because I find that the code is easier to think about, especially with how steps chain together.
For this blog post, we are going to look at the JSON code editor view.
Step 4: Write your Step Function Logic
Thanks to the amazing @jennworks40 - we were able to start building a template for our state machine very rapidly with her initial Step Function template.
Here is my finished code if you want to check it out:
{
"Comment": "Building a tree is fun!",
"StartAt": "I'm grateful to learn and grow",
"States": {
"I'm grateful to learn and grow": {
"Type": "Pass",
"Next": "From webinars to IRL community events"
},
"From webinars to IRL community events": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:xxxxxxxxxx:function:Thankful",
"Catch": [
{
"ErrorEquals": [
"States.TaskFailed"
],
"Next": "All run by amazing AWS leaders and visionaries..."
}
],
"Next": "All run by amazing AWS leaders and visionaries..."
},
"All run by amazing AWS leaders and visionaries...": {
"Type": "Pass",
"Next": "Who care about the AWS Community and make sure we are content."
},
"Who care about the AWS Community and make sure we are content.": {
"Type": "Parallel",
"Branches": [
{
"StartAt": "AWS leaders who help,",
"States": {
"AWS leaders who help,": {
"Type": "Succeed"
}
}
},
{
"StartAt": "AWS leaders who care,",
"States": {
"AWS leaders who care,": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:xxxxxxxxxx:function:Thankful",
"Catch": [
{
"ErrorEquals": [
"States.TaskFailed"
],
"Next": "We ā¤ļøāš„ you all!"
}
],
"End": true
},
"We ā¤ļøāš„ you all!": {
"Type": "Pass",
"Result": "Love em",
"End": true
}
}
},
{
"StartAt": "And AWS leaders who are always there.",
"States": {
"And AWS leaders who are always there.": {
"Type": "Succeed"
}
}
}
],
"Next": "It's no small task, the immense work they do"
},
"It's no small task, the immense work they do": {
"Type": "Parallel",
"Next": "Thank you for all that you do. We all love you!",
"Branches": [
{
"StartAt": "Helping us reach for the stars,",
"States": {
"Helping us reach for the stars,": {
"Type": "Pass",
"End": true
}
}
},
{
"StartAt": "Climb to new heights,",
"States": {
"Climb to new heights,": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:xxxxxxxxxx:function:Thankful",
"Catch": [
{
"ErrorEquals": [
"States.TaskFailed"
],
"Next": "We ā¤ļøāš„ the āļø"
}
],
"End": true
},
"We ā¤ļøāš„ the āļø": {
"Type": "Pass",
"Result": "Beautiful",
"End": true
}
}
},
{
"StartAt": "Believe in ourselves,",
"States": {
"Believe in ourselves,": {
"Type": "Pass",
"End": true
}
}
},
{
"StartAt": "Always work hard,",
"States": {
"Always work hard,": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-east-1:xxxxxxxxxx:function:Thankful",
"Catch": [
{
"ErrorEquals": [
"States.TaskFailed"
],
"Next": "We ā¤ļøāš„ to build!"
}
],
"End": true
},
"We ā¤ļøāš„ to build!": {
"Type": "Pass",
"Result": "Good company",
"End": true
}
}
},
{
"StartAt": "And share some cool swag, always something new.",
"States": {
"And share some cool swag, always something new.": {
"Type": "Pass",
"End": true
}
}
}
]
},
"Thank you for all that you do. We all love you!": {
"Type": "Pass",
"End": true
}
}
}
In case you are wondering where the arn
's come from, check out Step 5 below.
Step 5: Create a Lambda Function
Creating a Lambda function ā a serverless script that can run in AWS and connect to various AWS resources, apps, and more ā is very easy. First, search for "Lambda" in the search bar at the top and you should click on the first item that shows up in the dropdown:
Next, we'll decide to create a lambda function with the orange button. This will bring up the Lambda function setup screen to select all the options, including a name and runtime, which we will select Python 3.11:
After we select to create the Lambda function, we'll then be redirected to the Lambda console with our new function:
Notice the code that was auto-generated for us. It's not much, but we love to see it:
import json
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
Pay particularly close notice to the arn
that is generated for the function. This arn
is like it's identification tag in AWS - we will use this in our step function flow in the above.
ARNs follow a specific format like this (yours will look a bit different with the variables): arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME
We will drop our arn's into the step function to correspond to the Lambda function we want to run. I just made one Lambda function, but you may have more and want to configure those in each of the state machine's places
This is what it looks like:
Step 6: Light it up! š
To create our state machine, we will need to create some IAM permissions to allow the state machine to interact with Lambd and also do some xray tracing. Approve these automatically suggested changes:
We will wait a second and then we should see the confirmation green banner notification saying that the IAM role was created successfully. We may need to wait up to 1-2 minutes for the role to be fully updated.
That was easy! Now our role is configured with all the right permissions for the step function flow.
Now for the fun part! Let's run our step function with a custom comment like this:
{
"Comment": "Thank you so much amazing AWS Leaders!!ā¤ļøāš„"
}
Now, when the function runs, we'll see green, meaning it worked š
The state machine will go from blueprint mode...
To lights on mode...
What Step Functions have to do with the AWS Community Builders Program
While you might be thinking that Step Functions is "just another AWS service", it embodies many of the attributes that makes the AWS Community Builders program so strong. Step Functions at their core link complex, powerful, or intricate processes together in a chain so that they all flow together and achieve synchronized movement. When working together, the parts create a well oiled machine that can deliver performance. Let's see how:
Orchestrated Processes and Orchestrated Learning: the ability to orchestrate complex systems and events is a powerful skill, and we are lucky to have amazing leaders and mentors who can orchestrate transformative career growth for us all.
State Management and Growth: growth and transformation should not be stagnant, and the AWS Leaders make sure to keep us dynamic, engaged, and on top of the latest trends and opportunities. State machines are always triaging new events down the flow of the pipeline to where they need to go, and the AWS Leaders make sure that we are moving forward in our careers and lives just like step functions.
Error Handling and Support Systems: like a good QA engineer, we need to have a safe space to test, debug, and work out the code before we ship it live. The Community Builders Program is such a space, where we can all feel comfortable supporting one another, testing out pitches and talks, and being there for each other through job interviews, major projects, and more.
Infinite Scalability: with a global community, you have an ever replenishing support community and circle from all around the globe. It is an incredible feeling to have friends from almost all parts of the world, and especially getting the chance to meet up with the AWS Community at various events like re:Invent, Summits, and meetups are truly so special.
Networking and Collaboration: just like we had to provision that IAM role to connect all of the various services and components of the step function flow together, the AWS Leaders who support the AWS Community Builders program serve this very important role too. By being able to bring leaders, product managers, and mentors together for us to build, learn, and co-create together, the AWS Leadership becomes this very glue, like IAM, that unites all of us together.
I am so thankful to have been a part of the AWS Community Builders program for the past few years, and while I am now an AWS DevTools Hero, I still champion the AWS Community Builders program whenever I can. It is truly what got me into myh development career and helped accelerate where my career has taken me so far. I am so thankful and grateful to everyone I have met through the AWS Community Builders program and the banner of this blog post is just a small sample of the many photos I have with folks I am honored to call friends, colleagues, mentors, and role models. Thank you, AWS Community Builders, for serving and continuing to serve such an important support community to me and everyone in the Community Builders program.
We ā¤ļøāš„ and appreciate you all.
- Brian
Posted on December 15, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.