AWS Lambda Timeout

When a Lambda function times out, it gives no warning — boom, your function just stops executing.

One can generally estimate how long a Lambda function will run, and add some cushion, but stuff happens and we should Promise to handle the unexpected as gracefully as possible !!

Approach

Create 2 Promises (P1/P2) and wait (race) until 1 of them finishes.

P1: Set a timeout to something less than the Lambda function timeout

P2: Run your business logic

The trick is then using Promise.race to capture when ONE of the promises finishes. In theory, the timeout should almost never happen first…


In layman’s terms …

Bitcoin, a store of value

Thanks for stopping by — following is intended for a non-technical audience, with just enough tech to make it spicy! None of the following is investment advice — just sharing info!

Bitcoin is 2 main things:

  • A currency-like digital asset.
  • A software Platform connecting a network of Nodes, Miners & Users — all explained below.

We will refer to the currency as “bitcoin” and the overall Platform as “Bitcoin”.

Bitcoin was introduced by Satoshi Nakamoto in 2008. It remains unclear to this day whether Satoshi is a man, woman or group of people. …


… and cake at the end

Same user request with results from different API endpoints

Scenario

You want to pull similar data from multiple 3rd party sources, inspect the results, and return most relevant content to the user.

Issue

Calling each API endpoint sequentially takes too long.

Approach

Using Promises, make the call to each API endpoint simultaneously — all of the work, and waiting, happens in parallel.

Promise me you’ll return quickly

Above technique was used in the development of https://app.staycay.io — a travel destination assistant.

For example, when user requests ‘cooking classes’ for a given destination, the AWS Lambda Node.js …


Leveraging Lambda Layers for Lightning Lookups !!

In an AWS serverless environment, the default solution for very low latency data access is usually DynamoDB.

Read response times depend on a variety of things, but for round numbers lets call it in the 10–20 milliseconds range (what I have experienced), to perform a keyed lookup from Lambda. What’s not to like.

This article discusses an approach to achieve sub-millisecond performance on datasets still in the multi-1000 records. This opens the door to more use cases, offers more control of data and access, and of course there’s raw performance.

TL;DR — Example

  • 7000+ Keys
  • 10MB total Javascript file size (in a Lambda…


Video demo of some of the key features in action

Implemented as Travel Destination Chatbot(staycay.io)

Getting a handle on what-it-takes, pieces-and-parts is often difficult to conceive — overwhelm is more the initial reaction. Following aims to orient both techies and tech-interested business folks to the main components. This is clearly an AWS-centric architecture, but many of the concepts apply to different infrastructure approaches.

But aren’t there a million ways to build a chatbot these days (“and it only takes 10 minutes!”) ? Maybe, but when a certain level of sophistication & control is needed, it’s a different ballgame, e.g …


One-stop destination shopping

Discover → Plan → Do → Save & Share

Easy Drilldown into Destination of choice (or direct)

City Overview. Day Planner. City Walks. Bookable activities, events, hotels, retreats, vacation homes. Plus all the destination details …

30 Countries — 6500+ cities, so far.

Watch: Video Demo

Go Play: staycay.io

For all the details, keep reading.

Discovery & Planning

Considering visiting Seattle, Washington for the weekend? Never been & don’t know much about it. Where to start?


www.facebook.com/petbotai & FB Messenger: petbotai

2 of the ML features: Word Association & Style Transfer

To dig deeper into the chatbot hype, I embarked on this wacky project of building one that took on the personality of anyone’s pet(s).

OK, the personality part is a stretch goal, but forced more creativity. Some Machine Learning techniques were thrown in to provide “cool tricks” your hi-tech virtual pet might do, like Image Style Transfer and Word Association!

Had to learn enough about a few things to get rolling, e.g. Dialogflow, Node.js, AWS DynamoDB, Facebook Messenger Bots, Machine Learning options and then integrate with various provider API’s.

The following online training was invaluable…

Paul Heath

2x CTO Travel Tech Co-Founder. Product Creator. Building www.yapmandu.com & www.staycay.io Twitter: @pheathwa

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store