Bumps [aws-cdk-lib](https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib) from 2.183.0 to 2.189.1. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/aws/aws-cdk/releases">aws-cdk-lib's releases</a>.</em></p> <blockquote> <h2>v2.189.1</h2> <h3>Bug Fixes</h3> <ul> <li><strong>core:</strong> implicit Aspect applications do not override custom Aspect applications (<a href="https://redirect.github.com/aws/aws-cdk/issues/34132">#34132</a>) (<a href="https://github.com/aws/aws-cdk/commit/b7f4bc7aee1d99b70e4d9d3cedea53e910ee37ef">b7f4bc7</a>)</li> </ul> <hr /> <h2>Alpha modules (2.189.1-alpha.0)</h2> <h2>v2.189.0</h2> <h3>Features</h3> <ul> <li><strong>apigatewayv2:</strong> dualstack HTTP and WebSocket API (<a href="https://redirect.github.com/aws/aws-cdk/issues/34054">#34054</a>) (<a href="https://github.com/aws/aws-cdk/commit/eec900e90f38f34f896b22cf36cb225fc9c13cc8">eec900e</a>)</li> <li>update L1 CloudFormation resource definitions (<a href="https://redirect.github.com/aws/aws-cdk/issues/34064">#34064</a>) (<a href="https://github.com/aws/aws-cdk/commit/9cb260266e92f45e40a19667e29ccf2decb3d2b8">9cb2602</a>)</li> <li><strong>bedrock:</strong> support Amazon Nova Reel 1.1 (<a href="https://redirect.github.com/aws/aws-cdk/issues/34070">#34070</a>) (<a href="https://github.com/aws/aws-cdk/commit/3da0c4d267dbb693ffc01b9fae69cebcb180cdec">3da0c4d</a>)</li> <li>support L2 constructs for Amazon S3 Tables (<a href="https://redirect.github.com/aws/aws-cdk/issues/33599">#33599</a>) (<a href="https://github.com/aws/aws-cdk/commit/2e95252fecbb1fec9874fd5af4b4bd6449d50471">2e95252</a>)</li> <li><strong>pipelines:</strong> add <code>V2</code> pipeline type support in L3 construct (<a href="https://redirect.github.com/aws/aws-cdk/issues/34005">#34005</a>) (<a href="https://github.com/aws/aws-cdk/commit/994e95289b589596179553a5b9d7201155bd9ed1">994e952</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/33995">#33995</a></li> </ul> <h3>Bug Fixes</h3> <ul> <li><strong>codepipeline:</strong> replace account root principal with pipeline role in trust policy for cross-account actions (under feature flag) (<a href="https://redirect.github.com/aws/aws-cdk/issues/34074">#34074</a>) (<a href="https://github.com/aws/aws-cdk/commit/2d901f4e7bb982221e1a48a13666939140109d5a">2d901f4</a>)</li> <li><strong>custom-resources:</strong> <code>AwsCustomResource</code> assumed role session name may contain invalid characters (<a href="https://redirect.github.com/aws/aws-cdk/issues/34016">#34016</a>) (<a href="https://github.com/aws/aws-cdk/commit/32b6b4d7fa99723efb667239fbe455ede43b92c6">32b6b4d</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/23260">#23260</a> <a href="https://redirect.github.com/aws/aws-cdk/issues/34011">#34011</a></li> </ul> <hr /> <h2>Alpha modules (2.189.0-alpha.0)</h2> <h3>Features</h3> <ul> <li><strong>ec2-alpha:</strong> implement mapPublicIpOnLaunch prop in SubnetV2 (<a href="https://redirect.github.com/aws/aws-cdk/issues/34057">#34057</a>) (<a href="https://github.com/aws/aws-cdk/commit/836c5cf3e4c627f817e4dc8ed2af28a5bba54792">836c5cf</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/32159">#32159</a></li> </ul> <h3>Bug Fixes</h3> <ul> <li><strong>amplify:</strong> unable to re-run integ test due to missing <code>status</code> field in <code>customRule</code> (<a href="https://redirect.github.com/aws/aws-cdk/issues/33973">#33973</a>) (<a href="https://github.com/aws/aws-cdk/commit/6638c08d56afe7ecc4f23cff4cf334b887001e5e">6638c08</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/33962">#33962</a></li> </ul> <h2>v2.188.0</h2> <h3>Features</h3> <ul> <li>update L1 CloudFormation resource definitions (<a href="https://redirect.github.com/aws/aws-cdk/issues/33980">#33980</a>) (<a href="https://github.com/aws/aws-cdk/commit/0923b5e82dd0c8da864f0c806f295fae270c22c1">0923b5e</a>)</li> <li>update L1 CloudFormation resource definitions (<a href="https://redirect.github.com/aws/aws-cdk/issues/34029">#34029</a>) (<a href="https://github.com/aws/aws-cdk/commit/be6210f246b97befcdc9446862e991071738008d">be6210f</a>)</li> <li><strong>codepipeline:</strong> add usePipelineRoleForActions field support in L2 (<a href="https://redirect.github.com/aws/aws-cdk/issues/33961">#33961</a>) (<a href="https://github.com/aws/aws-cdk/commit/d8bbc1c3f8479ab5031b8684364735b9a6c31fa2">d8bbc1c</a>)</li> <li><strong>codepipeline-actions:</strong> support <code>ECRBuildAndPublish</code> action (<a href="https://redirect.github.com/aws/aws-cdk/issues/33375">#33375</a>) (<a href="https://github.com/aws/aws-cdk/commit/c5cd679b2f979b9e51c7a071b18d930d3a475129">c5cd679</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/33376">#33376</a></li> <li><strong>codepipeline-actions:</strong> support <code>InspectorEcrImageScanAction</code> and <code>InspectorSourceCodeScanAction</code> actions (<a href="https://redirect.github.com/aws/aws-cdk/issues/33378">#33378</a>) (<a href="https://github.com/aws/aws-cdk/commit/2dc8cc7f703ebcd61f2b5f4d20401a1ade788e7a">2dc8cc7</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/33377">#33377</a></li> <li><strong>cognito:</strong> v3.0 pre token generation trigger event (<a href="https://redirect.github.com/aws/aws-cdk/issues/33778">#33778</a>) (<a href="https://github.com/aws/aws-cdk/commit/ea1436f85d036bddb9a96dd54f02a639c3aab212">ea1436f</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/33733">#33733</a></li> <li><strong>events-targets:</strong> support ApiGatewayV2 HttpApi (<a href="https://redirect.github.com/aws/aws-cdk/issues/33864">#33864</a>) (<a href="https://github.com/aws/aws-cdk/commit/91a3076fb16369629a710ebc560c103a91c2ea20">91a3076</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/26649">#26649</a></li> <li><strong>kinesisfirehose:</strong> support S3 file extension format (<a href="https://redirect.github.com/aws/aws-cdk/issues/33776">#33776</a>) (<a href="https://github.com/aws/aws-cdk/commit/e314a9aa5d149704cc2abd30927a41d317a3ce6c">e314a9a</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/32154">#32154</a></li> <li><strong>logs-destinations:</strong> support Amazon Data Firehose logs destination (<a href="https://redirect.github.com/aws/aws-cdk/issues/33683">#33683</a>) (<a href="https://github.com/aws/aws-cdk/commit/a8edf696e91c44cbda286889896464960dd03266">a8edf69</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/32038">#32038</a> <a href="https://redirect.github.com/aws/aws-cdk/issues/24766">#24766</a></li> <li><strong>pipelines:</strong> actions can default to the pipeline service role instead of a newly created role (<a href="https://redirect.github.com/aws/aws-cdk/issues/33991">#33991</a>) (<a href="https://github.com/aws/aws-cdk/commit/2ebc51e694e85aa0d8e0401dbb1fc1037298eda5">2ebc51e</a>)</li> <li><strong>rds:</strong> engine lifecycle support (<a href="https://redirect.github.com/aws/aws-cdk/issues/33902">#33902</a>) (<a href="https://github.com/aws/aws-cdk/commit/c0f8d293df157cd196e2bd9fb569374d0535f471">c0f8d29</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/33859">#33859</a></li> </ul> <h3>Bug Fixes</h3> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/aws/aws-cdk/blob/main/CHANGELOG.v2.alpha.md">aws-cdk-lib's changelog</a>.</em></p> <blockquote> <h1>Changelog</h1> <p>All notable changes to this project will be documented in this file. See <a href="https://github.com/conventional-changelog/standard-version">standard-version</a> for commit guidelines.</p> <h2><a href="https://github.com/aws/aws-cdk/compare/v2.198.0-alpha.0...v2.199.0-alpha.0">2.199.0-alpha.0</a> (2025-05-27)</h2> <h2><a href="https://github.com/aws/aws-cdk/compare/v2.197.0-alpha.0...v2.198.0-alpha.0">2.198.0-alpha.0</a> (2025-05-22)</h2> <h3>⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES</h3> <ul> <li><strong>amplify:</strong> A compute role is created when <code>platform</code> is <code>Platform.WEB_COMPUTE</code> or <code>Platform.WEB_DYNAMIC</code>.</li> </ul> <h3>Features</h3> <ul> <li><strong>amplify:</strong> add compute role support for Amplify app (<a href="https://redirect.github.com/aws/aws-cdk/issues/33962">#33962</a>) (<a href="https://github.com/aws/aws-cdk/commit/7490b921aa2c464e32ad27064fa4b84571d5ba1a">7490b92</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/33882">#33882</a></li> <li><strong>ec2:</strong> add i7i instance class (<a href="https://redirect.github.com/aws/aws-cdk/issues/34453">#34453</a>) (<a href="https://github.com/aws/aws-cdk/commit/3fe8ab4bb100e23042f3d55d4a52bfc8cdbf495a">3fe8ab4</a>)</li> </ul> <h2><a href="https://github.com/aws/aws-cdk/compare/v2.196.1-alpha.0...v2.197.0-alpha.0">2.197.0-alpha.0</a> (2025-05-20)</h2> <h2><a href="https://github.com/aws/aws-cdk/compare/v2.196.0-alpha.0...v2.196.1-alpha.0">2.196.1-alpha.0</a> (2025-05-19)</h2> <h2><a href="https://github.com/aws/aws-cdk/compare/v2.195.0-alpha.0...v2.196.0-alpha.0">2.196.0-alpha.0</a> (2025-05-15)</h2> <h3>Features</h3> <ul> <li><strong>msk:</strong> support Kafka versions 3.9.x and 3.9.x Kraft (<a href="https://redirect.github.com/aws/aws-cdk/issues/34213">#34213</a>) (<a href="https://github.com/aws/aws-cdk/commit/a1226db3164f885ab1bbf13a18697831cfde74d0">a1226db</a>)</li> <li><strong>pipes-targets:</strong> add SNS (<a href="https://redirect.github.com/aws/aws-cdk/issues/34159">#34159</a>) (<a href="https://github.com/aws/aws-cdk/commit/2f846b395cc5061363bd6def946a04740ac0139b">2f846b3</a>)</li> <li><strong>s3tables:</strong> server-side encryption by customer managed KMS key (<a href="https://redirect.github.com/aws/aws-cdk/issues/34229">#34229</a>) (<a href="https://github.com/aws/aws-cdk/commit/488f0db714c20fcaf5dbdf682277a70c6a938d3f">488f0db</a>)</li> </ul> <h3>Bug Fixes</h3> <ul> <li><strong>ec2:</strong> dual-stack vpc without private subnets creates EgressOnlyInternetGateway (under feature flag) (<a href="https://redirect.github.com/aws/aws-cdk/issues/34437">#34437</a>) (<a href="https://github.com/aws/aws-cdk/commit/35e818b4f86638b5fe6074705511d1eee16266d2">35e818b</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/30981">#30981</a></li> <li><strong>ec2-alpha:</strong> fix resource id references and tags for migration behind feature flag (<a href="https://redirect.github.com/aws/aws-cdk/issues/34377">#34377</a>) (<a href="https://github.com/aws/aws-cdk/commit/aa735341a8e95224a14241b5e1c5c5ba71de5022">aa73534</a>)</li> </ul> <h2><a href="https://github.com/aws/aws-cdk/compare/v2.194.0-alpha.0...v2.195.0-alpha.0">2.195.0-alpha.0</a> (2025-05-07)</h2> <h3>⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES</h3> <ul> <li><strong>iot:</strong> By default, <code>deviceDertificateAgeCheck</code> is automatically enabled.</li> </ul> <h3>Features</h3> <ul> <li><strong>iot:</strong> device certificate age check audit configuration (<a href="https://redirect.github.com/aws/aws-cdk/issues/33816">#33816</a>) (<a href="https://github.com/aws/aws-cdk/commit/9ad383d5300c5d5f5a9d2552fbd541436570a404">9ad383d</a>)</li> <li><strong>location:</strong> support L2 API Key Construct (<a href="https://redirect.github.com/aws/aws-cdk/issues/32733">#32733</a>) (<a href="https://github.com/aws/aws-cdk/commit/d86787889dd49dce220324d141bf48e1bfa8fc3b">d867878</a>), closes <a href="https://redirect.github.com/aws/aws-cdk/issues/30684">#30684</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/aws/aws-cdk/commit/e7432ee4f8ae6f4ba000b1c1833188dddeb15624"><code>e7432ee</code></a> chore(release): 2.189.1</li> <li><a href="https://github.com/aws/aws-cdk/commit/b7f4bc7aee1d99b70e4d9d3cedea53e910ee37ef"><code>b7f4bc7</code></a> fix(core): implicit Aspect applications do not override custom Aspect applica...</li> <li><a href="https://github.com/aws/aws-cdk/commit/dcd077fb04f6900fd92e127d92a777cc38cdf932"><code>dcd077f</code></a> chore: update analytics metadata blueprints</li> <li><a href="https://github.com/aws/aws-cdk/commit/b997bf125f0782d37fb8c99db0e0be09f4b10295"><code>b997bf1</code></a> chore(release): 2.189.0</li> <li><a href="https://github.com/aws/aws-cdk/commit/eec900e90f38f34f896b22cf36cb225fc9c13cc8"><code>eec900e</code></a> feat(apigatewayv2): dualstack HTTP and WebSocket API (<a href="https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib/issues/34054">#34054</a>)</li> <li><a href="https://github.com/aws/aws-cdk/commit/9cb260266e92f45e40a19667e29ccf2decb3d2b8"><code>9cb2602</code></a> feat: update L1 CloudFormation resource definitions (<a href="https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib/issues/34064">#34064</a>)</li> <li><a href="https://github.com/aws/aws-cdk/commit/2d901f4e7bb982221e1a48a13666939140109d5a"><code>2d901f4</code></a> fix(codepipeline): replace account root principal with pipeline role in trust...</li> <li><a href="https://github.com/aws/aws-cdk/commit/3da0c4d267dbb693ffc01b9fae69cebcb180cdec"><code>3da0c4d</code></a> feat(bedrock): support Amazon Nova Reel 1.1 (<a href="https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib/issues/34070">#34070</a>)</li> <li><a href="https://github.com/aws/aws-cdk/commit/b1e8879a800850efb130cb8aaaef596195de56f9"><code>b1e8879</code></a> docs(pipelines): add link to developer guide on how to use docker drop-in rep...</li> <li><a href="https://github.com/aws/aws-cdk/commit/1b98a41853c17dcce53c5bb7074011c8dd928fb3"><code>1b98a41</code></a> docs(batch): add note on update fatgate compute environment (<a href="https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib/issues/34022">#34022</a>)</li> <li>Additional commits viewable in <a href="https://github.com/aws/aws-cdk/commits/v2.189.1/packages/aws-cdk-lib">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/swift-server/swift-aws-lambda-runtime/network/alerts). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
This directory contains example code for Lambda functions.
Pre-requisites
-
Ensure you have the Swift 6.x toolchain installed. You can install Swift toolchains from Swift.org
-
When developing on macOS, be sure you use macOS 15 (Sequoia) or a more recent macOS version.
-
To build and archive your Lambda functions, you need to install docker.
-
To deploy your Lambda functions and invoke them, you must have an AWS account and install and configure the
awscommand line. -
Some examples are using AWS SAM. Install the SAM CLI before deploying these examples.
-
Some examples are using the AWS CDK. Install the CDK CLI before deploying these examples.
Examples
-
API Gateway: an HTTPS REST API with Amazon API Gateway and a Lambda function as backend (requires AWS SAM).
-
API Gateway with Lambda Authorizer: an HTTPS REST API with Amazon API Gateway protected by a Lambda authorizer (requires AWS SAM).
-
BackgroundTasks: a Lambda function that continues to run background tasks after having sent the response (requires AWS CLI).
-
CDK: a simple example of an AWS Lambda function invoked through an Amazon API Gateway and deployed with the Cloud Development Kit (CDK).
-
HelloJSON: a Lambda function that accepts JSON as an input parameter and responds with a JSON output (requires AWS CLI).
-
HelloWorld: a simple Lambda function (requires AWS CLI).
-
S3EventNotifier: a Lambda function that receives object-upload notifications from an Amazon S3 bucket.
-
S3_AWSSDK: a Lambda function that uses the AWS SDK for Swift to invoke an Amazon S3 API (requires AWS SAM).
-
S3_Soto: a Lambda function that uses Soto to invoke an Amazon S3 API (requires AWS SAM).
-
[Streaming]: create a Lambda function exposed as an URL. The Lambda function streams its response over time. (requires AWS SAM).
-
Testing: a test suite for Lambda functions.
AWS Credentials and Signature
This section is a short tutorial on the AWS Signature protocol and the AWS credentials.
What is AWS SigV4?
AWS SigV4, short for "Signature Version 4," is a protocol AWS uses to authenticate and secure requests. When you, as a developer, send a request to an AWS service, AWS SigV4 makes sure the request is verified and hasn’t been tampered with. This is done through a digital signature, which is created by combining your request details with your secret AWS credentials. This signature tells AWS that the request is genuine and is coming from a user who has the right permissions.
How to Obtain AWS Access Keys and Session Tokens
To start making authenticated requests with AWS SigV4, you’ll need three main pieces of information:
-
Access Key ID: This is a unique identifier for your AWS account, IAM (Identity and Access Management) user, or federated user.
-
Secret Access Key: This is a secret code that only you and AWS know. It works together with your access key ID to sign requests.
-
Session Token (Optional): If you're using temporary security credentials, AWS will also provide a session token. This is usually required if you're using temporary access (e.g., through AWS STS, which provides short-lived, temporary credentials, or for federated users).
To obtain these keys, you need an AWS account:
-
Sign up or Log in to AWS Console: Go to the AWS Management Console, log in, or create an AWS account if you don’t have one.
-
Create IAM User: In the console, go to IAM (Identity and Access Management) and create a new user. Ensure you set permissions that match what the user will need for your application (e.g., permissions to access specific AWS services, such as AWS Lambda).
-
Generate Access Key and Secret Access Key: In the IAM user credentials section, find the option to generate an "Access Key" and "Secret Access Key." Save these securely! You’ll need them to authenticate your requests.
-
(Optional) Generate Temporary Security Credentials: If you’re using temporary credentials (which are more secure for short-term access), use AWS Security Token Service (STS). You can call the
GetSessionTokenorAssumeRoleAPI to generate temporary credentials, including a session token.
With these in hand, you can use AWS SigV4 to securely sign your requests and interact with AWS services from your Swift app.