Hi friends of the cloud π
first things first: we've put in the hard work in the last weeks and finally moved to the final stages, having all of our chapters proof-read for the last time!
For giving you a few insights into our last few weeks, which not only consisted of iterating chapters but also with heavily underestimating seemingly small things:
... and much more π
Nevertheless: we're here now and we'll release in January 2023. You'll receive another email within the next days about the final date. π€ π
I hope you're already as excited as we are! π
Let's finish this newsletter with an introduction to AWS API Gateway! π It's a small extract from the upcoming book! π
β
β
AWS API Gateway is another crucial part of serverless applications on AWS. Itβs a fully-managed service that acts as a front door for the internet to your applicationβs ecosystem.
Contrary to other methods that allow exposure to the internet, like Lambda function URLs, itβs not only a simple way to trigger invocations via external sources but also does access control, data transformations, rate-limiting, and much more. Itβs also not limited to Lambda functions but many other AWS services or any backend that speaks HTTP.
API Gateway is beginner-friendly as itβs easy to deploy your first API and there are no upfront or idling costs you need to fear.
AWS API Gateway comes in three different flavors, with very different feature sets and different pricing. A small wrap-up before going into details:
The high-value benefits of managed services are not only about not having to operate underlying infrastructure and therefore reducing your costs for operations. Itβs also about generally reducing the need for a lot of boilerplate implementation code that can be error-prone and conflicting in many ways.
And thatβs exactly what all AWS API Gateway types do very well as it comes with many no or low-code but high-value features that neither require deep knowledge nor long experiences.
HTTP APIs are designed for a minimal feature set, increasing the speed to deploy your first API while not having to fear high costs per API call. As with REST Gateways, HTTP Gateways are also RESTful API products allowing you to map HTTP resources and methods to your AWS services.
Imagining web applications, we mostly think about clients like browsers or mobile apps that are making HTTP calls to exposed services and afterward wait for the responses.
Depending on the connections between the client and the server, this includes low or high latencies as each request involves a complete roundtrip between the client and server. Also, connections are not steadily kept open, so initial requests can take longer due to TLS handshakes that are rather compute-intense. If clients are actively waiting for data to update, they need to regularly poll and cause load on your servers even if the data didnβt update yet.
But thatβs not the only client-server communication option.
WebSockets enable you to keep steady connection channels between your application and your client that allow sending messages in both directions. This allows you to actively push messages to clients. With the publish/subscribe pattern, you can easily cluster clients to manage which data clients should receive.
Weβve learned about the different API Gateway types, which leads us to two prominent use cases.
The typical web application is a client-server combination: a frontend - regardless if itβs a web page or mobile app - that communicates via a backend via HTTP. On the serverless side, your backend is a construct of one or multiple Lambda functions that include your business logic. Exposing those functions to the internet is done via a REST or HTTP API Gateway that allows you to actively enforce rate-limiting, request validation and transformation, routing, authentication, and authorization without writing much or any code at all.
Many applications require real-time communication between the clients and the backend. If you look at messaging apps, you donβt want all your clients to actively poll for new messages every few seconds as it causes unnecessary server load and also causes a high latency between a message that has been sent and the actual delivery at the receiver. With WebSockets API Gateway a client can open a connection to the gateway that is fully managed by the gateway itself. The only thing that needs to be actively implemented is how connection events are handled and what you want to do with those connections. A common pattern is to save the connection identifiers that are provided by the gateway to DynamoDB. Via a connection identifier, you can actively push messages to the corresponding client.
As said before, API Gateway is not just an HTTP mediator - itβs a feature-rich, high-value, and little error-prone front door to your application's ecosystem.
If looking at REST or HTTP gateways, an API is a collection of programmable resources. Those resources can map to one or several HTTP methods and to a path that is either very specific or does contain a proxy wildcard so it covers a set of paths.
Each of those resources needs to be connected to an integration endpoint to which a request will be forwarded. This can be for example a Lambda function or any HTTP-speaking endpoint. You can choose to either forward the request as-is or apply transformations that will modify the request in a way that the corresponding backend expects it to be. This can also include validations. After the response is received from the integration, you can apply response transformations before itβs returned to the client.
A wrap-up about all those core capabilities which will be explored in detail in the next paragraphs:
[...]
β
That's it for today.
We already wish you a great & successful new year! π
All the best,β
Sandro & Tobi π
Join our community of over 9,300 readers delving into AWS. We highlight real-world best practices through easy-to-understand visualizations and one-pagers. Expect a fresh newsletter edition every two weeks.
Newsletter Header AWS FOR THE REAL WORLD β±οΈ Reading time: 8 minutes π Main Learning: Migrating from Edgio to CloudFront βοΈ Blog Post π» GitHub Repository Hey Reader ππ½ this newsletter is about π₯ AI π€ We haven't talked too much about AI, Bedrock, MCPs, and agents yet - so we want to change that. Please let us know if this it interests you to build AI on AWS, or if you are much more interested on hands-on fundamentals services. Should we focus on AI Services? Yes, I want to learn to build...
Newsletter Header AWS FOR THE REAL WORLD β±οΈ Reading time: 8 minutes π Main Learning: Migrating from Edgio to CloudFront βοΈ Blog Post π» GitHub Repository Hey Reader ππ½ This newsletter edition is all about saving Lambda costs. I (Sandro is writing this one) was recently involved in saving Lambda costs for a client. So, I thought writing down my thought process was a good idea. Have fun with it! If you need help saving AWS costs or improving your infrastructure, just reply to this email! Now...
β Reading time: 8 minutes π Main Learning: Federated Authentication with Cognito πΎ GitHub Repository βοΈ Read the Full Post Online π Hey Reader ππ½ Federated Authentication lets users sign in to your app using their existing accounts - most prominently Google! This approach eliminates the need to create and remember new credentials (which most users are very happy for! β¨), improving user experience and likely increasing conversion rates. π With OAuth 2.0 and Google as an identity provider, we...