Better DevServerless on AWShttps://betterdev.blog/en-usMaciej RadzikowskiSat, 01 Jun 2024 23:05:01 GMTdaily1Should you minify Lambda code?https://betterdev.blog/lambda-code-minification/https://betterdev.blog/lambda-code-minification/I thought minimizing Lambda function code was a best practice for Lambda optimization - it&#39;s even recommended by AWS in a <a href="https://aws.amazon.com/blogs/compute/optimizing-node-js-dependencies-in-aws-lambda/">not-so-old blog post</a>. Turns out, <strong>I was wrong</strong>.Fri, 12 Apr 2024 00:00:00 GMTMaciej RadzikowskiAWSserverlesslambdaperformancecold-startMaciej RadzikowskiNext-Level Integration Testing with ServerlessSpyhttps://betterdev.blog/integration-testing-with-serverless-spy/https://betterdev.blog/integration-testing-with-serverless-spy/Integration testing for serverless Event-Driven Architecture is as necessary as it is time-consuming. Boilerplate code to write, long waiting for tests completion, tedious debugging. But no more.Tue, 26 Mar 2024 00:00:00 GMTMaciej RadzikowskiAWScdktestingserverlessMaciej Radzikowski25 Good and Bad Serverless (and other) Announcements from re:Invent 2023https://betterdev.blog/25-good-and-bad-serverless-announcements-reinvent-2023/https://betterdev.blog/25-good-and-bad-serverless-announcements-reinvent-2023/AWS re:Invent 2023 ended, so let&#39;s look at the most interesting announcements for serverless and more. There are exciting <strong>features to try</strong> and, maybe more importantly, <strong>features to avoid</strong>!Mon, 04 Dec 2023 00:00:00 GMTMaciej RadzikowskiAWSawslambdastep-functionsloggingdynamodbreinventserverlessMaciej RadzikowskiDynamic Content with Lambda Response Streaminghttps://betterdev.blog/lambda-response-streaming-dynamic-content/https://betterdev.blog/lambda-response-streaming-dynamic-content/With some creativity, we can use Lambda Response Streaming to <strong>dynamically show status updates</strong>, like the progress of long-running processes. And with proper <strong>TypeScript types</strong> and <strong>generator functions</strong>, we can write clean, dynamic content streaming Lambda with composable payload enrichers that will impress your work colleagues (if they are into this stuff).Wed, 22 Nov 2023 00:00:00 GMTMaciej RadzikowskiAWSserverlesslambdaresponse-streamingMaciej RadzikowskiForcing Lambda Response Streaming to Flush Contenthttps://betterdev.blog/lambda-response-streaming-flush-content/https://betterdev.blog/lambda-response-streaming-flush-content/Lambda Response Streaming allows sending incremental responses, but those response chunks can arrive long after you write them. <strong>They are buffered in a rather unexpected way, delaying all messages you stream.</strong> But there is a workaround to force the stream to flush.Tue, 19 Sep 2023 00:00:00 GMTMaciej RadzikowskiAWSserverlesslambdaresponse-streamingMaciej RadzikowskiBuilding a CDK Construct Library: thoughts and tipshttps://betterdev.blog/building-cdk-construct-library/https://betterdev.blog/building-cdk-construct-library/I recently created a CDK library provisioning <a href="https://merapar.com/finally-the-cdk-ci-pipeline-that-serverless-deserves/">a CI/CD pipeline for serverless apps on AWS</a>. Having finished the &quot;regular&quot; JS library, it took me a day to convert it to a &quot;proper&quot; CDK Construct library. Not long, and I learned a lot. Here are my thoughts and tips.Wed, 14 Jun 2023 00:00:00 GMTMaciej RadzikowskiAWSawslambdacdkMaciej RadzikowskiAWS Lambda - Node.js vs. Python for serverlesshttps://betterdev.blog/aws-lambda-runtime-nodejs-python/https://betterdev.blog/aws-lambda-runtime-nodejs-python/After tabs vs. spaces, vi vs. emacs, let&#39;s fight over this: <strong>which is better, Node.js or Python for AWS Lambda and serverless in general?</strong> I have my opinion on this, and the fact I prefer TypeScript over Python makes me only slightly biased.Wed, 15 Mar 2023 00:00:00 GMTMaciej RadzikowskiAWSpythonserverlessawslambdajavascripttypescriptnodejsMaciej RadzikowskiUnderstanding Logical IDs in CDK and CloudFormationhttps://betterdev.blog/understanding-logical-ids-in-cdk-and-cloudformation/https://betterdev.blog/understanding-logical-ids-in-cdk-and-cloudformation/CDK generates Logical IDs used by the CloudFormation to track and identify resources. In this post, I&#39;ll explain what Logical IDs are, how they&#39;re generated, and why they&#39;re important. Understanding this will help you avoid unexpected resource deletions and baffling &quot;resource already exists&quot; errors during deployment.Tue, 17 Jan 2023 00:00:00 GMTMaciej RadzikowskiAWScloudcdkcloudformationMaciej RadzikowskiTop 12 Serverless Announcements from re:Invent 2022https://betterdev.blog/top-12-serverless-announcements-reinvent-2022/https://betterdev.blog/top-12-serverless-announcements-reinvent-2022/re:Invent 2022, the annual AWS conference in Las Vegas, is now behind us. I did not attend in person, but that gave me time to consolidate this list of top new serverless features while everyone else is sleeping off the intense 5-day conference. And I envy them just a little.Tue, 06 Dec 2022 00:00:00 GMTMaciej RadzikowskiAWScloudserverlessreinventlambdaevent-bridgeMaciej RadzikowskiHow to pass AWS Certification examshttps://betterdev.blog/how-to-pass-aws-certification-exams/https://betterdev.blog/how-to-pass-aws-certification-exams/I&#39;ve never cared too much about certificates, apart from the SSL ones (haha). And yet I passed 7 AWS exams. Why? How to prepare? How to pass? How to pay only 50% for the exam? I answer all this and more in this post.Wed, 23 Nov 2022 00:00:00 GMTMaciej RadzikowskiAWScertificationMaciej RadzikowskiRunning Serverless ML on AWS Lambdahttps://betterdev.blog/serverless-ml-on-aws-lambda/https://betterdev.blog/serverless-ml-on-aws-lambda/Yes, you can run Machine Learning models on serverless, directly with AWS Lambda. I know because I built and productionized such solutions. It&#39;s not complicated, but there are a few things to be aware of. I explain them in this in-depth tutorial, where we build a serverless ML pipeline.Thu, 10 Nov 2022 00:00:00 GMTMaciej RadzikowskiAWScdkmachine-learningarchitectureMaciej RadzikowskiLeast deployment privilege with CDK Bootstraphttps://betterdev.blog/cdk-bootstrap-least-deployment-privilege/https://betterdev.blog/cdk-bootstrap-least-deployment-privilege/Security is not convenient. That&#39;s probably why the CDK, by default, uses <code>AdministratorAccess</code> Policy to deploy resources. But we can easily change it and increase the security of our AWS account, following the least privilege principle with a minimal additional burden.Tue, 30 Aug 2022 00:00:00 GMTMaciej RadzikowskiAWScdksecurityMaciej RadzikowskiThe AWS CDK, Or Why I Stopped Being a CDK Skeptichttps://betterdev.blog/aws-cdk-pros-and-cons/https://betterdev.blog/aws-cdk-pros-and-cons/Until recently, I was skeptical about the AWS CDK. I believe in Infrastructure as Code (IaC), but with the &quot;code&quot; being YAML. But after using CDK in real projects, the amount of heavy lifting it does and the vast reduction of a boilerplate code changed my view.Wed, 29 Jun 2022 00:00:00 GMTMaciej RadzikowskiAWScdkMaciej RadzikowskiThings I Found Interesting #5https://betterdev.blog/tifi-5/https://betterdev.blog/tifi-5/After some time, I accumulated enough articles to share. They are about cloud, tech, programming, and work, and also include two games, a petition, and a survey.Wed, 11 May 2022 00:00:00 GMTMaciej RadzikowskiThings I Found InterestingMaciej RadzikowskiDecision Tree: choose the right AWS messaging servicehttps://betterdev.blog/decision-tree-sqs-sns-kinesis-eventbridge/https://betterdev.blog/decision-tree-sqs-sns-kinesis-eventbridge/Have you ever been stuck deciding between SQS, SNS, Kinesis Streams, and EventBridge? Struggled to pick the right one for your use case? If the answer is &quot;yes&quot;, I&#39;ve got you covered with a simple decision tree to help you make the right decision.Tue, 12 Apr 2022 00:00:00 GMTMaciej RadzikowskiAWSmessagingarchitecturecloudserverlessMaciej RadzikowskiPersonal backup to Amazon S3 - cheap and easyhttps://betterdev.blog/personal-backup-to-amazon-s3/https://betterdev.blog/personal-backup-to-amazon-s3/In need to backup my personal files in the cloud, I wrote a script that archives the data into the Amazon S3 bucket. After some fine-tuning and solving a bunch of edge-cases, it&#39;s limited mainly by the disk read and my internet upload speed. And it costs me only $3.70 per <a href="https://en.wikipedia.org/wiki/Binary_prefix">TiB</a> per month.Wed, 09 Mar 2022 00:00:00 GMTMaciej RadzikowskiAWSbashs3cloudMaciej Radzikowski6 Common Pitfalls of AWS Lambda with Kinesis Triggerhttps://betterdev.blog/aws-lambda-kinesis-trigger-pitfalls/https://betterdev.blog/aws-lambda-kinesis-trigger-pitfalls/The simplicity of setting up a Kinesis trigger for a Lambda function may be deceptive. There are pitfalls that can cause problems we will spot only later, in the production environment. I learned about some of them the hard way, so let&#39;s say I speak from the experience.Tue, 21 Dec 2021 00:00:00 GMTMaciej RadzikowskiAWSmessagingarchitectureMaciej RadzikowskiThings I Found Interesting #4https://betterdev.blog/tifi-4/https://betterdev.blog/tifi-4/Two articles about the Blockchain on today&#39;s list. Both are not in favor, I&#39;m afraid. Apart from this, some tools, work thoughts and advice, and again an article so weird I couldn&#39;t categorize it.Mon, 13 Dec 2021 00:00:00 GMTMaciej RadzikowskiThings I Found InterestingMaciej RadzikowskiHeadless CMS with Gatsby on AWS for $0.00 per monthhttps://betterdev.blog/gatsby-website-with-headless-cms-on-aws/https://betterdev.blog/gatsby-website-with-headless-cms-on-aws/Can you have a <strong>website with a CMS on AWS</strong> and not pay just for its existence? I looked at Amazon Lightsail, headless WordPress, and Webiny CMS but <strong>found none of those suitable</strong>. So I choose Prismic – a SaaS headless CMS, and Gatsby to create the site. Yes, I needed to make a pipeline to build my website after content changes. But when I did it, <strong>I got a website with CMS hosted at no cost</strong>.Wed, 13 Oct 2021 00:00:00 GMTMaciej RadzikowskiAWScloudserverlessMaciej RadzikowskiChoosing between SQS, SNS, Kinesis, and EventBridgehttps://betterdev.blog/aws-messaging-services-sqs-sns-kinesis-eventbridge/https://betterdev.blog/aws-messaging-services-sqs-sns-kinesis-eventbridge/AWS can overwhelm with the number of services. Especially if multiple services seem to do a very similar job. Let&#39;s look at the cloud-native AWS messaging services – the SQS, SNS, Kinesis, and EventBridge. What are the differences and when to use which one?Thu, 05 Aug 2021 00:00:00 GMTMaciej RadzikowskiAWSserverlessmessagingarchitecturecloudMaciej RadzikowskiThings I Found Interesting #3https://betterdev.blog/tifi-3/https://betterdev.blog/tifi-3/Here we are <a href="/category/things-i-found-interesting/">again</a>, with selected content from all over the internet about tools, tech, cloud, programming, work, and a single article I couldn&#39;t categorize. Probably because I&#39;m still in shock after reading it.Tue, 13 Jul 2021 00:00:00 GMTMaciej RadzikowskiThings I Found InterestingMaciej RadzikowskiDon't help others (immediately)https://betterdev.blog/dont-help-others-immediately/https://betterdev.blog/dont-help-others-immediately/I know my coworkers and teammates are reading this, and probably my boss as well. But let&#39;s risk it.Thu, 01 Jul 2021 00:00:00 GMTMaciej RadzikowskiOtherMaciej RadzikowskiAWS Lambda Performance Optimizationhttps://betterdev.blog/aws-lambda-performance-optimization/https://betterdev.blog/aws-lambda-performance-optimization/There are two reasons to optimize AWS Lambda functions performance. First is <strong>money</strong> – you pay for the Lambda execution duration. The quicker you do the job, the less you pay. The second is <strong>latency</strong> – the quicker you do the job, the shorter your client waits for the result. It&#39;s a <a href="https://www.forbes.com/sites/steveolenski/2016/11/10/why-brands-are-fighting-over-milliseconds/">known fact</a> that the decrease of latency improves sales, user engagement, and client satisfaction – so we could argue it&#39;s also the money, in the end.Mon, 26 Apr 2021 00:00:00 GMTMaciej RadzikowskiAWSserverlesslambdaserverless-frameworkcold-startperformanceMaciej RadzikowskiThings I Found Interesting #2https://betterdev.blog/tifi-2/https://betterdev.blog/tifi-2/Two months after the <a href="/tifi-1/">previous edition</a>, I gathered enough interesting resources to share them. In this edition, you will find content about HTTP, WebDev, versioning, tech, and problem solving.Wed, 14 Apr 2021 00:00:00 GMTMaciej RadzikowskiThings I Found InterestingMaciej RadzikowskiAWS JavaScript SDK v3 - usage, problems, testinghttps://betterdev.blog/aws-javascript-sdk-v3-usage-problems-testing/https://betterdev.blog/aws-javascript-sdk-v3-usage-problems-testing/The new version of AWS SDK for JavaScript / TypeScript / Node.js came with a few significant improvements. But does &quot;General Availability&quot; mean &quot;ready for the production&quot;? How to use it? And how to unit test our code using it? Let&#39;s take a look at it.Mon, 22 Mar 2021 00:00:00 GMTMaciej RadzikowskiAWSlambdajavascripttypescripttestingMaciej RadzikowskiAWS Lambda logging best practiceshttps://betterdev.blog/aws-lambda-logging-best-practices/https://betterdev.blog/aws-lambda-logging-best-practices/Logging in AWS Lambda functions is simple. You just print the message, and it&#39;s sent to the CloudWatch Logs. And everything is fine until you get a surprisingly big bill for the CloudWatch usage, or you need to actually debug some live system. Here are my tips for logging in AWS Lambda, based on my experience with real-live, big-scale functions running on production.Mon, 01 Mar 2021 00:00:00 GMTMaciej RadzikowskiAWSserverlessawslambdaserverless-frameworkcloudMaciej RadzikowskiThings I Found Interesting #1https://betterdev.blog/tifi-1/https://betterdev.blog/tifi-1/Welcome to the first issue of Things I Found Interesting – an irregular series of links to, well, interesting content. Below are eleven articles and resources on various software-related topics, which I stumbled upon in the last several weeks.Fri, 12 Feb 2021 00:00:00 GMTMaciej RadzikowskiThings I Found InterestingMaciej RadzikowskiPin exact dependency versionshttps://betterdev.blog/pin-exact-dependency-versions/https://betterdev.blog/pin-exact-dependency-versions/Buckle up, for some of you this may be controversial, but maybe for some others – obvious. This is how to prevent a problem causing your application to out of the sudden stop behaving correctly, or, even more funny, stop behaving correctly only on one developer&#39;s computer. We can solve this with one two simple tricks.Thu, 04 Feb 2021 00:00:00 GMTMaciej RadzikowskiProgrammingdependenciesMaciej RadzikowskiThree ways to create Amazon Athena tableshttps://betterdev.blog/creating-athena-tables/https://betterdev.blog/creating-athena-tables/Here I show three ways to create Amazon Athena tables. More importantly, I show when to use which one (and when don&#39;t) depending on the case, with comparison and tips, and a sample data flow architecture implementation. Also, I have a short rant over redundant AWS Glue features. All in a single article. Enjoy.Tue, 12 Jan 2021 00:00:00 GMTMaciej RadzikowskiAWSserverless-frameworkcloudserverlessathenabig-dataMaciej RadzikowskiMinimal safe Bash script templatehttps://betterdev.blog/minimal-safe-bash-script-template/https://betterdev.blog/minimal-safe-bash-script-template/Bash scripts. Almost anyone needs to write one sooner or later. Almost no one says &quot;yeah, I love writing them&quot;. And that&#39;s why almost everyone is putting low attention while writing them.Mon, 14 Dec 2020 00:00:00 GMTMaciej RadzikowskiProgrammingclishellbashMaciej RadzikowskiAuto-generated website environment parametershttps://betterdev.blog/auto-generated-website-environment-parameters/https://betterdev.blog/auto-generated-website-environment-parameters/There are multiple articles on how to host a static website or Single Page Application (SPA) on AWS. But they rarely go into the topic of setting up the environment variables for the frontend application.Mon, 16 Nov 2020 00:00:00 GMTMaciej RadzikowskiAWSserverless-frameworkcloudserverlessapifrontendMaciej RadzikowskiMy AWS toolbox - tools, plugins and applicationshttps://betterdev.blog/my-aws-toolbox/https://betterdev.blog/my-aws-toolbox/Developers, like all specialists, discover and collect their favorite tools over time. Having a good, proven set of tools makes the work easier and more pleasant. We can focus on getting the job done. Sometimes eliminating minor inconveniences or improving a small element of everyday activity makes the greatest impact on the comfort of work.Thu, 22 Oct 2020 00:00:00 GMTMaciej RadzikowskiAWSclicloudserverlessdocumentationpluginsarchitectureserverless-frameworkMaciej RadzikowskiServerless Swagger UI for API Gatewayhttps://betterdev.blog/serverless-swagger-ui-for-api-gateway/https://betterdev.blog/serverless-swagger-ui-for-api-gateway/Amazon API Gateway provides an option to export the API schema as an OpenAPI Specification. With it, we can display our REST API as an interactive website. But we do not get a public URL to that specification file which we could use as a source for an interactive page like Swagger. Instead, we can only get the file from the AWS Console, CLI, or SDK.Tue, 13 Oct 2020 00:00:00 GMTMaciej RadzikowskiAWSserverlessapiswaggerdocumentationserverless-frameworkcloudMaciej RadzikowskiCommand line arguments anatomy explained with exampleshttps://betterdev.blog/command-line-arguments-anatomy-explained/https://betterdev.blog/command-line-arguments-anatomy-explained/Many of the scripts and executables allow providing some command line arguments. They may be required or optional. There are flags, that are just switches changing command behavior. There are, of course, arguments with values. And there are so-called positional arguments – parameters given in some order without any extra indications.Fri, 25 Sep 2020 00:00:00 GMTMaciej RadzikowskiToolsclishellMaciej RadzikowskiSpeed up everyday work with handy Git aliaseshttps://betterdev.blog/handy-git-aliases/https://betterdev.blog/handy-git-aliases/Git allows us to define <a href="https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases">aliases</a>, which are basically our own commands we can use. They may be just a calls for other commands with parameters, or even shell scripts. Possibilities are unlimited.Sun, 13 Sep 2020 00:00:00 GMTMaciej RadzikowskiToolscligitMaciej RadzikowskiSimpler Git branch first push with no more errorshttps://betterdev.blog/git-branch-first-push-without-errors/https://betterdev.blog/git-branch-first-push-without-errors/How many times did you try to make <code>git push</code> for a newly created branch to the remote repository, only to get a strange &quot;no upstream branch&quot; error? Here I will show how to change <a href="https://git-scm.com/">Git</a> configuration with a single command to get rid of it for good.Fri, 11 Sep 2020 00:00:00 GMTMaciej RadzikowskiToolscligitMaciej RadzikowskiGit fast-forward merge - why you should turn it offhttps://betterdev.blog/turn-off-git-fast-forward-merge/https://betterdev.blog/turn-off-git-fast-forward-merge/<a href="https://git-scm.com/">Git</a> is a standard version control tool. You should definitely use it even for small personal projects. And when it comes to any teamwork, it&#39;s mandatory.Wed, 09 Sep 2020 00:00:00 GMTMaciej RadzikowskiToolscligitMaciej Radzikowski