Wrzasq.pl

X-Ray tracing for AWS Rust SDK in Lambda runtime

Thursday, 09 March 2023, 01:20

Rust becomes more and more widely used in many places and AWS cloud is no exception. With AWS SDK for Rust (currently in preview) and Rust runtime for Lambda it's possible to build regular Lambda functions. Rust gives those serverless components safety and runtime speed but it's still quite new and ecosystem around Rust for AWS Lambda does not cover all features from other SDKs. One of such missing features is good X-Ray integration. There is no fully-flagged instrumentation for Rust SDK and if you search for solutions how to include such tracing in Rust projects using SDK… you will find planty of different solutions and there is high chance that none of them is what you are looking for.

Tags: , , ,

» Komentarze

CloudFormation custom resource providers - with any runtime, any toolchain, any deployment pipeline

Thursday, 27 May 2021, 22:05

Yes, CloudFormation again. It may seems funny how many trouble case-studies and troubleshooting guides I can write for a tool I claim is best IaaC solution for AWS cloud… but I bet this is how it works for most of popular tools - you always have some edge cases and new features that require stabilization, yet if the tool is flexible enough you can overcome the downsides. In CloudFormation you can do so by using macros, modules, custom resources ("old way") or - subject of this post - resource providers. Resource providers allow for extending CloudFormation capabilities to handle custom resources in a standardized approach. You can think of it as a superior replacement for AWS::CloudFormation::CustomResource. Custom resources had a lot of limitations: you had to manage permissions for each instance - in resource providers it's the provider that defines required permissions; resource handler execution time was limited to single Lambda execution time (in fact you could count it times three thanks for handling retries) which was up to 45 minutes in current setup - resource providers allow you to report progress and integrate stabilization flow to extend this time to tens of hours. Resource providers are more integrated with CloudFormation service itself - in fact huge part of natively-supported resources is released open-source by AWS as resource providers. As always there is also some but and here I will try to describe my little experiment lifting the boundaries of resource providers to cover scenarios and needs that AWS claims are not "supported" right now.

Tags: , , , ,

» Komentarze

Provisioning AWS Athena queries with Lambda and StepFunctions

Saturday, 30 May 2020, 23:21

Amazon Athena is a brilliant tool for data processing and analytics in AWS cloud. Under the hood it utilizes Presto engine to query and process data in your S3 storage using standard SQL notation. The concept behind it is truely simple - run SQL queries against your data in S3 and pay only for the resurces consumed by the query. No cluster to manage - everything fully serverless and managed by Amazon; no need to learn new technology - you query data using SQL that most likely is known among your team; no need for additional storage or fees - you store data directly in S3. Did I mention a keyword serverless? Yes, it runs completely via API SDK, no need to manage any resource on your own (and cold startup in Athena is super low). It integrates tightly with Glue. When we say serverless in AWS we mainly think Lambda. And for sure, sooner or later you will want to integrate your query into some more complex workflow.

Tags: , , , ,

» Komentarze

Monitoring Lambda memory usage - X-Ray aware version

Tuesday, 30 July 2019, 07:17

In serverless architecture on AWS Lambda is a basic computing service. AWS provides some basic metrics related to it, like execution time, invocations count etc. but one important metric is missing - memory consumption. Knowing how much memory your functions use allows you to optimize resources and reduce costs (or increase to avoid failures). It can be very simply generated out of logs (since Lambda logs execution report after each invocation) with CloudWatch metric filter feature. And this approach has been described plenty of times around the web, including ready solutions. So I will not elaborate that much on the concept, as has already been done. But there is one trick - if you use X-Ray this solutions will not work. At least - not out of the box.

Tags: , , , , , ,

» Komentarze

Deploying Lambda@Edge with pl.wrzasq.lambda

Thursday, 22 November 2018, 13:12

When working with cloud, one of the most efficient approaches you can leverage is serverless architecture. This concept allows you to define your entire application as set of interacting resources, without worrying about underlying infrastructure. Serverless applications can scale virtually to infinity, are cost-effective, lower maintenance costs (forget about patching kernels, installing system packages, defining upgrade paths etc.). Per-se, serverless it is a general pattern, but I will focus on AWS as this is my area of expertise - here, the main computing unit in serverless world is Lambda. It is a FaaS component that allows you to run your piece of code "in the cloud", which means decoupled form any computing hardware. Such code pieces can be triggered by you to perform some computation, but can also act as a handlers for various events across the platform (like SNS message processors, API Gateway authorization handlers and many many more). One of such integration ways is Lambda@Edge, which allows for handling CloudFront request events.

Tags: , , , , ,

» Komentarze

Multiple Amazon API Gateway stages

Sunday, 03 December 2017, 23:08

Short time ago I described CI/CD pipeline design, that allows for handling multiple environment deployments replicated from same CloudFormation template. Process is usually quite easy if you have some EC2-based deployment, per-environment ECS cluster or Lambda functions that you can deploy freely however you like. Things get complicated when you integrate API Gateway. The easiest way would be to deploy separate APIs for each of your environments. But it seems so wrong, isn't it? API Gateway has a feature of stages, that seems to be perfect for such cases.

Tags: , , , ,

» Komentarze

Java+AWS Lambda+Spring - a little less wrong way

Sunday, 07 May 2017, 22:46

FaaS approach is still quite fresh and developers keep comming out with better and better solutions for handling it. One of the leading cloud services providing function applications is AWS Lambda and here I will describe my exprience with it, but I'm pretty sure these clues can apply regardless of provider, which you use. Obviously when a developer face new environment, like this, the easiest way is to try it out with your known technological stack. And no matter how improper it seems to be, you can handle it with Java. And when Java, you will very likely also think of using Spring to help you with it. How? Why? Why not?

Tags: , , , , ,

» Komentarze