1. 程式人生 > >Things Go Better With Step Functions

Things Go Better With Step Functions

I often give presentations on Amazon’s culture of innovation, and start out with a slide that features a revealing quote from Amazon founder Jeff Bezos:

I love to sit down with our customers and to learn how we have empowered their creativity and to pursue their dreams. Earlier this year I chatted with

Patrick Brandt from The Coca-Cola Company in order to learn how they used AWS Step Functions and other AWS services to support the Coke.com Vending Pass program. This program includes drink rewards earned by purchasing products at vending machines equipped to support mobile payments using the Coca-Cola Vending Pass
. Participants swipe their NFC-enabled phones to complete an Apple Pay or Android Pay purchase, identifying themselves to the vending machine and earning credit towards future free vending purchases in the process

After the swipe, a combination of SNS topics and AWS Lambda functions initiated a pair of calls to some existing backend code to count the vending points and update the participant’s record. Unfortunately, the backend code was slow to react and had some timing dependencies, leading to missing updates that had the potential to confuse Vending Pass participants. The initial solution to this issue was very simple: modify the Lambda code to include a 90 second delay between the two calls. This solved the problem, but ate up process time for no good reason (billing for the use of Lambda functions is based on the duration of the request, in 100 ms intervals).

In order to make their solution more cost-effective, the team turned to AWS Step Functions, building a very simple state machine. As I wrote in an earlier blog post, Step Functions coordinate the components of distributed applications and microservices at scale, using visual workflows that are easy to build.

Coke built a very simple state machine to simplify their business logic and reduce their costs. Yours can be equally simple, or they can make use of other Step Function features such as sequential and parallel execution and the ability to make decisions and choose alternate states. The Coke state machine looks like this:

The FirstState and the SecondState states (Task states) call the appropriate Lambda functions while Step Functions implements the 90 second delay (a Wait state). This modification simplified their logic and reduced their costs. Here’s how it all fits together:

What’s Next
This initial success led them to take a closer look at serverless computing and to consider using it for other projects. Patrick told me that they have already seen a boost in productivity and developer happiness. Developers no longer need to wait for servers to be provisioned, and can now (as Jeff says) unleash their creativity and pursue their dreams. They expect to use Step Functions to improve the scalability, functionality, and reliability of their applications, going far beyond the initial use for the Coca-Cola Vending Pass. For example, Coke has built a serverless solution for publishing nutrition information to their food service partners using Lambda, Step Functions, and API Gateway.

Patrick and his team are now experimenting with machine learning and artificial intelligence. They built a prototype application to analyze a stream of photos from Instagram and extract trends in tastes and flavors. The application (built as a quick, one-day prototype) made use of Lambda, Amazon DynamoDB, Amazon API Gateway, and Amazon Rekognition and was, in Patrick’s words, a “big win and an enabler.”

In order to build serverless applications even more quickly, the development team has created an internal CI/CD reference architecture that builds on the Serverless Application Framework. The architecture includes a guided tour of Serverless and some boilerplate code to access internal services and assets. Patrick told me that this model allows them to easily scale promising projects from “a guy with a computer” to an entire development team.

Jeff;

相關推薦

Things Go Better With Step Functions

I often give presentations on Amazon’s culture of innovation, and start out with a slide that features a revealing quote from Amazon founder Jeff

Create a Serverless Workflow with AWS Step Functions

In this tutorial, you will learn how to use AWS Step Functions to design and run a serverless workflow that coordinates multiple AWS Lambda func

【文藝學生】Learning with exploration, and go ahead with learning. Let's progress together! :)

文藝學生 Learning with exploration, and go ahead with learning. Let's progress together! :)

Pixel 3 Review: A Phone Made Better with AI

Google debuted the Pixel 3 and Pixel 3 XL with dual front-facing cameras and glass body last week, and while there are notable hardware improvements, it's

How to black box test a Go app with RSpec

Automated testing is all the rage in web development these days and goes on across the whole industry. A well-written test dramatically reduces the risk of

Listeners with several functions in Kotlin. How to make them shine?

One question I get often is how to simplify the interaction with listeners that have several functions on Kotlin. For listeners (or any interfaces) w

Using Go modules with Travis CI

In my previous post I converted httpstat to use Go 1.11’s upcoming module support. In this post I continue to explore integrating Go modules into a con

Make Your Build Better With Mage GopherAcademy

Many Go projects can be built using only Go’s wonderful built-in tooling. However, for many projects, these commands may

How to build Go plugin with data inside @ Alex Pliutau's Blog

Go 1.8 gives us a new tool for creating shared libraries, called plugins! This new plugin buildmode is currently only supported on Linux. But

Learning Concepts with Energy Functions

We've developed an energy-based model that can quickly learn to identify and generate instances of concepts, such as near, above, between, closest,

Invoke AWS Lambda when a State (Execution Event) Changes in AWS Step Functions

Before you begin this procedure, you must: Confirm that the event change that you want to trigger the Lambda function i

AWS Step Functions

An application workflow with branching conditions has more than one path. In this example, there are 10 arrows (or arcs) connecting steps. T

Tarification d'AWS Step Functions

Un flux de travail d'application ayant des conditions en ramification a plusieurs chemins. Dans cet exemple, il y a 10 flèches (ou arcs) qui

AWS Step Functions

AWS Step Functions vous permet de coordonner plusieurs services AWS dans des flux de travail sans serveur afin de créer et mettre à jour rapidem

Debugging Go programs with the GNU Debugger

30 October 2011 Last year we reported that Go's gc/ld toolchain produces DWARFv3 debugging information that

AWS Step Functions視覺化工作流服務_分散式應用調節

AWS Step Functions 讓您將多個 AWS 服務協調為無伺服器工作流,以便您可以快速構建和更新應用程式。使用 Step Functions,您可以設計和執行將 AWS Lambda 和 Amazon ECS 等服務整合到功能豐富的應用程式中的工作流。工作流由一系列步驟組成,

Mastering the game of Go with deep neural networks and tree search

深度 策略 參數初始化 技術 以及 -1 簡單 cpu 網絡 Silver, David, et al. "Mastering the game of Go with deep neural networks and tree search." Nature 529.758

linux go with vscode

manually figure install ted rep page f11 compiler truct 1 install go apt install golang 將會同時安裝下列軟件: golang-1.9 golang-1.9-doc golan

TED - How To Get Better At The Things You Care About

things idea cte model ora through phi som 但是 TED01 - How To Get Better At The Things You Care About 昨天我發布了攻克英語口語的宣言,今天就行動。TED是我們學習口語的好地方,

[Javascript Crocks] Compose Functions for Reusability with the Maybe Type

chain clas ren ise methods nothing rewrite isempty there We can dot-chain our way to great success with an instance of Maybe, but there a