<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Aws-Cdk on agh1973</title><link>https://blog.agh1973.com/tags/aws-cdk/</link><description>Recent content in Aws-Cdk on agh1973</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 17 Nov 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.agh1973.com/tags/aws-cdk/index.xml" rel="self" type="application/rss+xml"/><item><title>CDK Integration Tests and the Alpha Package Version Dance</title><link>https://blog.agh1973.com/posts/cdk-integ-tests-alpha-versions/</link><pubDate>Mon, 17 Nov 2025 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/cdk-integ-tests-alpha-versions/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;So&amp;hellip; we have a bunch of small CDK construct libraries that are mostly just a Lambda function.
We added integration tests, like you do these days. And renovate, because we aren&amp;rsquo;t barbarians.
And then I got this error while trying to address stupid nodejs runtime issues:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;TypeError: (0 , core_1.determineLatestNodeRuntimeName) is not a function
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The root cause is simple: CDK&amp;rsquo;s alpha packages (&lt;code&gt;@aws-cdk/integ-tests-alpha&lt;/code&gt;, &lt;code&gt;@aws-cdk/integ-runner&lt;/code&gt;) must exactly match your &lt;code&gt;aws-cdk-lib&lt;/code&gt; version. And when you&amp;rsquo;re using Projen with &lt;code&gt;experimentalIntegRunner: true&lt;/code&gt;, it adds these packages as &lt;code&gt;latest&lt;/code&gt;, which works great until it doesn&amp;rsquo;t.&lt;/p&gt;</description></item><item><title>The NODEJS_LATEST Saga: A CDK Runtime Version Tale (with a Happy Ending)</title><link>https://blog.agh1973.com/posts/nodejs-latest-cdk-runtime-saga/</link><pubDate>Mon, 17 Nov 2025 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/nodejs-latest-cdk-runtime-saga/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I am of the strong opinion that infrastructure as code should actually, you know, manage your infrastructure. So you don&amp;rsquo;t have to.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s kind of the whole point of CDK.&lt;/p&gt;
&lt;p&gt;Which is why it was so frustrating when our security team (reasonably!) demanded we update hundreds of Lambda functions to Node 22, and CDK&amp;rsquo;s &lt;code&gt;NODEJS_LATEST&lt;/code&gt; was stuck on Node 18. And then Node 18 hit end-of-life in April 2025&amp;hellip; and &lt;code&gt;NODEJS_LATEST&lt;/code&gt; was &lt;em&gt;still&lt;/em&gt; pointing at it.&lt;/p&gt;</description></item><item><title>Projen</title><link>https://blog.agh1973.com/posts/projen/</link><pubDate>Sat, 22 May 2021 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/projen/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;One of the things that&amp;rsquo;s worth noting about the hugo-cdk project
is how much, well&amp;hellip; boilerplate is involved.&lt;/p&gt;
&lt;p&gt;We have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.gitignore&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.npmignore&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.prettierrc.js&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;jest.config.js&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;package-lock.json&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;package.json&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tsconfig.json&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And none of these are really central to the actual project code.
And&amp;hellip; they&amp;rsquo;re also pretty important files.
Which&amp;hellip; I don&amp;rsquo;t really understand as well as I&amp;rsquo;d like to.
For example, I&amp;rsquo;d like to do a really great job of linting,
but I don&amp;rsquo;t want to spend a bunch of time learning the
intricacies of &lt;code&gt;eslint&lt;/code&gt;. Surely there must be a better way than
googling around the interwebs for someone else&amp;rsquo;s configs?&lt;/p&gt;</description></item><item><title>CDK Bootstrap v4</title><link>https://blog.agh1973.com/posts/cdk-bootstrap-v4/</link><pubDate>Mon, 01 Mar 2021 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/cdk-bootstrap-v4/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Running along happily with cdk and then it barfs out this at you:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[+] Unknown Rules: {&amp;#34;CheckBootstrapVersion&amp;#34;:{&amp;#34;Assertions&amp;#34;:[{&amp;#34;Assert&amp;#34;:{&amp;#34;Fn::Not&amp;#34;:[{&amp;#34;Fn::Contains&amp;#34;:[[&amp;#34;1&amp;#34;,&amp;#34;2&amp;#34;,&amp;#34;3&amp;#34;],{&amp;#34;Ref&amp;#34;:&amp;#34;BootstrapVersion&amp;#34;}]}]},&amp;#34;AssertDescription&amp;#34;:&amp;#34;CDK bootstrap stack version 4 required. Please run &amp;#39;cdk bootstrap&amp;#39; with a recent version of the CDK CLI.&amp;#34;}]}}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;What to do?&lt;/p&gt;
&lt;h2 id="tldr"&gt;
 tl;dr:
 &lt;a class="heading-link" href="#tldr"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;AWS_ACCOUNT_NUMBER&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;263869919117&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;CDK_NEW_BOOTSTRAP&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; npx cdk bootstrap aws://&lt;span style="color:#e6db74"&gt;${&lt;/span&gt;AWS_ACCOUNT_NUMBER&lt;span style="color:#e6db74"&gt;}&lt;/span&gt;/us-east-1 --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>yarn &gt; npm</title><link>https://blog.agh1973.com/posts/yarn-gt-npm/</link><pubDate>Sat, 16 Jan 2021 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/yarn-gt-npm/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I was recently tackling yet another annoying import confusion while upgrading CDK.
I was asking questions on one of the slack channels about this problem and eventually
someone asked me &amp;ldquo;are you using npm instead of yarn? Why?&amp;rdquo;
I didn&amp;rsquo;t have a good answer.
I don&amp;rsquo;t have much background at all with &lt;code&gt;nodejs&lt;/code&gt;, so I had just been using &lt;code&gt;npm&lt;/code&gt;.
Well&amp;hellip;&lt;/p&gt;</description></item><item><title>Deploying a Static Site on AWS with CDK</title><link>https://blog.agh1973.com/posts/cdk-deploying-static-site/</link><pubDate>Wed, 02 Dec 2020 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/cdk-deploying-static-site/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ve covered a bunch of other ground, but now it&amp;rsquo;s time to actually deploy the static site.&lt;/p&gt;
&lt;h3 id="a-static-site"&gt;
 A Static Site
 &lt;a class="heading-link" href="#a-static-site"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Referring back to our diagram, it&amp;rsquo;s clear that the first thing
after the CodeBuild, which we are doing separately, is an S3 bucket.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;export&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;StaticSite&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;extends&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;cdk&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Construct&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;constructor&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;scope&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;cdk.Construct&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;string&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;super&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;scope&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;bucket&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;s3&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Bucket&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#39;Bucket&amp;#39;&lt;/span&gt;, {});
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This gets our first layer of boiler-plate out of the way.
We&amp;rsquo;ve declared &lt;code&gt;StaticSite&lt;/code&gt; as a class and based it on the &lt;code&gt;cdk.Construct&lt;/code&gt;.
Then we declared an S3 bucket. With no properties.
Ok, but&amp;hellip; S3 buckets are more useful when they have names.
And&amp;hellip; our website is going to have a name.
S3 bucket names are required to be globally unique,
and dns names are by definition globally unique.
Let&amp;rsquo;s use the name of the website for the name of the bucket.
This has the added benefit of improving the discoverability of the system
since you can pretty quickly associate the DNS and the S3 bucket
when the have the same name.&lt;/p&gt;</description></item><item><title>Persisting EBS Volumes on EC2</title><link>https://blog.agh1973.com/posts/persist-ebs-ec2/</link><pubDate>Wed, 14 Oct 2020 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/persist-ebs-ec2/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Recently I was tasked with spinning up an &lt;code&gt;ec2&lt;/code&gt; instance with some attached &lt;code&gt;ebs&lt;/code&gt; &amp;ldquo;disks&amp;rdquo;.
This isn&amp;rsquo;t generally how I roll.
It&amp;rsquo;s old-school, the opposite of the modern, serverless / on-demand way.
It drove me to write some particularly clever &lt;code&gt;bash&lt;/code&gt; code to manage &lt;code&gt;/etc/fstab&lt;/code&gt;.
I hate writing clever &lt;code&gt;bash&lt;/code&gt; code. It never turns out well.
I can imagine this being useful to someone else who gets stuck solving this problem.
I sincerely hope it won&amp;rsquo;t ever be useful to me again.&lt;/p&gt;</description></item><item><title>Node Lambdas - A Better Way</title><link>https://blog.agh1973.com/posts/node-lambdas/</link><pubDate>Sun, 04 Oct 2020 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/node-lambdas/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;In &lt;a href="../getting-started-with-cdk" &gt;Getting Started with CDK&lt;/a&gt;,
I wrote &amp;ldquo;I noticed that cdk has a pattern of using a lambdas directory
and then having sub-directories for every lambda&amp;rdquo;.
Well, I was wrong, or maybe things have just changed.
Either way, we&amp;rsquo;re going to update &lt;code&gt;hugo-cdk&lt;/code&gt; to follow the new pattern.&lt;/p&gt;
&lt;h3 id="the-new-pattern"&gt;
 The New Pattern
 &lt;a class="heading-link" href="#the-new-pattern"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Recently, cdk was updated to add bundling support.
We didn&amp;rsquo;t need bundling with our previous lambda, because it doesn&amp;rsquo;t depend on any libraries.
The new pattern is still a more elegant approach,
so lets take a look at the fancy but plainly named
&lt;a href="https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-nodejs-readme.html" class="external-link" target="_blank" rel="noopener"&gt;aws-lambda-nodejs&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>CDK Composition</title><link>https://blog.agh1973.com/posts/cdk-composition/</link><pubDate>Thu, 10 Sep 2020 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/cdk-composition/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;So far in this series, we have
&lt;a href="../getting-started-with-hugo" &gt;set up the basics of a Hugo blog and push the code to GitHub&lt;/a&gt;
and &lt;a href="../getting-started-with-cdk" &gt;bootstrapped a cdk application and used it to deployed a lambda&lt;/a&gt;.
Then your faithless narrator wandered off for a month,
and when he came back nagged you about &lt;a href="../upgrading-cdk" &gt;upgrading cdk&lt;/a&gt;.
Our next step is to deploy the rest of what was described
in &lt;a href="../serving-static-site-with-aws" &gt;serving static sites with AWS&lt;/a&gt;.
That&amp;rsquo;s going to require us to add a few more things to our cdk app,
so now is a good time to talk about apps, stacks and constructs.&lt;/p&gt;</description></item><item><title>Upgrading CDK</title><link>https://blog.agh1973.com/posts/upgrading-cdk/</link><pubDate>Fri, 04 Sep 2020 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/upgrading-cdk/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Well, &amp;ldquo;catch you next week&amp;rdquo; was a bit optimistic.
My writing goal of a blog post per week might need to be updated to one per month.
On the topic of updates and sustainability,
today I&amp;rsquo;m going to talk about updating cdk.&lt;/p&gt;
&lt;h3 id="but-why-update"&gt;
 But Why Update
 &lt;a class="heading-link" href="#but-why-update"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;It&amp;rsquo;s 2020. Almost 2021. Let&amp;rsquo;s all agree that software has bugs.
Keeping things patched is just a reality of life.
Also, cdk is moving pretty quickly these days.
It is usually less work to make multiple small upgrades than a single large one.&lt;/p&gt;</description></item><item><title>Getting Started with CDK</title><link>https://blog.agh1973.com/posts/getting-started-with-cdk/</link><pubDate>Thu, 06 Aug 2020 00:00:00 +0000</pubDate><guid>https://blog.agh1973.com/posts/getting-started-with-cdk/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="heading-link" href="#introduction"&gt;
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading"&gt;&lt;/i&gt;
 &lt;span class="sr-only"&gt;Link to heading&lt;/span&gt;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/aws/aws-cdk" class="external-link" target="_blank" rel="noopener"&gt;aws-cdk&lt;/a&gt; was the new hotness at AWS re:Invent 2019,
going from about 4 presentations in 2018 to something like 40 presentations.
That&amp;rsquo;s an order of magnitude increase.
And that is the kind of thing that gets my attention.
cdk offers &lt;a href="https://www.google.com/search?q=define&amp;#43;iac" class="external-link" target="_blank" rel="noopener"&gt;IaC&lt;/a&gt; that is&amp;hellip; code.
It&amp;rsquo;s not a &lt;a href="https://en.wikipedia.org/wiki/Domain-specific_language" class="external-link" target="_blank" rel="noopener"&gt;dsl&lt;/a&gt; (looking at you, Terraform).
Nor is it an attempt to overwhelm you with JSON or YAML verbosity.
It&amp;rsquo;s&amp;hellip; just&amp;hellip; TypeScript.
And that turns out to be powerful.&lt;/p&gt;</description></item></channel></rss>