Files
swift-aws-lambda-runtime/Examples/CDK
dependabot[bot] 56e822f943 Bump minimatch and aws-cdk-lib in /Examples/CDK/infra (#654)
Removes [minimatch](https://github.com/isaacs/minimatch). It's no longer
used after updating ancestor dependency
[aws-cdk-lib](https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib).
These dependencies need to be updated together.

Removes `minimatch`

Updates `aws-cdk-lib` from 2.240.0 to 2.240.0
<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.239.0-alpha.0...v2.240.0-alpha.0">2.240.0-alpha.0</a>
(2026-02-23)</h2>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.238.0-alpha.0...v2.239.0-alpha.0">2.239.0-alpha.0</a>
(2026-02-19)</h2>
<h3>⚠ BREAKING CHANGES</h3>
<p>redshift-alpha: update default node type from <code>DC2_LARGE</code>
to <code>RA3_LARGE</code></p>
<h3>Features</h3>
<ul>
<li><strong>bedrock-agentcore-alpha:</strong> add
<code>fromCodeAsset</code> method to create runtime artifact with local
code assets (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36472">#36472</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/c5a87e6682a3668de849d4c7a0913fdee3eb170c">c5a87e6</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/36473">#36473</a></li>
<li><strong>bedrock-agentcore-alpha:</strong> added new target type (api
gateway) in agentcore gateway target. (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36841">#36841</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/0842754ec56412a9b22f2e92f5aea7c86129ec52">0842754</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/36817">#36817</a></li>
<li><strong>mixins-preview:</strong> add ECS ClusterSettingsMixin (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36796">#36796</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/b8ab5be8f2e0733433a55dd48b26e7f56f6e0393">b8ab5be</a>)</li>
<li><strong>mixins-preview:</strong> add s3 bucket mixin for
publicAccessBlock (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36905">#36905</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/feed4b2690bd481e464dd3ececa4cba0997a03db">feed4b2</a>)</li>
<li><strong>mixins-preview:</strong> send Vended Logs to pre-created
DeliveryDestination using <code>toDestination()</code> (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36896">#36896</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/48f1fe6aa86473a25ffdcf53cfecb5e1169b54db">48f1fe6</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>redshift-alpha:</strong> update default node type from
<code>DC2_LARGE</code> to <code>RA3_LARGE</code> (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36516">#36516</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/ea19e5cde2e64d5cdcdfa3af41764542e77e221c">ea19e5c</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/36416">#36416</a></li>
</ul>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.237.1-alpha.0...v2.238.0-alpha.0">2.238.0-alpha.0</a>
(2026-02-09)</h2>
<h3>Features</h3>
<ul>
<li><strong>eks-v2-alpha:</strong> add support for
bootstrapSelfManagedAddons (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36740">#36740</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/1ffe38dc950a096cb5e1c1ee20f2c49899dc0a23">1ffe38d</a>)</li>
<li><strong>eks-v2-alpha:</strong> add support for EKS hybrid nodes (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36749">#36749</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/48ace56d82537630fc339cb41962473a97375aea">48ace56</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>eks-v2-alpha:</strong> ensure kubectl provider and handler
functions use the same vpc configuration (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36735">#36735</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/4e02f0896069105dae83c46f19f1b346a546ad57">4e02f08</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/34878">#34878</a>
<a
href="https://redirect.github.com/aws/aws-cdk/issues/34877">#34877</a></li>
<li><strong>ivs-alpha:</strong> add region constraints to integration
tests (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36851">#36851</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/d55fec42357410b8263b814b931daf5dccc5c5e3">d55fec4</a>)</li>
<li><strong>mixins-preview:</strong> apply mixins in order (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36847">#36847</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/726060c0ea9f57de4c6e13c1f50c330e4fc2608e">726060c</a>)</li>
<li><strong>mixins-preview:</strong> apply mixins in order in
<code>MixinApplicator</code> (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36877">#36877</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/09db1c99710c9f8e91774e767de93fff1a0d2650">09db1c9</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/36847">#36847</a></li>
</ul>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.237.0-alpha.0...v2.237.1-alpha.0">2.237.1-alpha.0</a>
(2026-02-03)</h2>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.236.0-alpha.0...v2.237.0-alpha.0">2.237.0-alpha.0</a>
(2026-02-02)</h2>
<h3>Features</h3>
<ul>
<li><strong>bedrock-agentcore-alpha:</strong> add support for custom
claims and scopes to runtime/gateway authorizers (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36810">#36810</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/a3abcd010648e83bed273dff8f581291b5b3c902">a3abcd0</a>)</li>
<li><strong>eks-v2-alpha:</strong> pass additional helm chart values to
aws-load-balancer-controller (<a
href="https://redirect.github.com/aws/aws-cdk/issues/36754">#36754</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/cf61814ac58448ddd70682e45c07dd8ca58c4fd1">cf61814</a>),
closes <a
href="https://github.com/aws//github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/helm/aws-load-balancer-controller/values.yaml/issues/L199">/github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/helm/aws-load-balancer-controller/values.yaml#L199</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/aws/aws-cdk/commits/v2.240.0/packages/aws-cdk-lib">compare
view</a></li>
</ul>
</details>
<br />


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 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/awslabs/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>
2026-03-01 10:54:25 +01:00
..

API Gateway and Cloud Development Kit

This is a simple example of an AWS Lambda function invoked through an Amazon API Gateway and deployed with the Cloud Development Kit (CDK).

Code

The Lambda function takes all HTTP headers it receives as input and returns them as output. See the API Gateway example for a complete description of the code.

Build & Package

To build the package, type the following commands.

swift build
swift package archive --allow-network-connections docker

If there is no error, there is a ZIP file ready to deploy. The ZIP file is located at .build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/APIGatewayLambda/APIGatewayLambda.zip

Deploy

[NOTE] Before deploying the infrastructure, you need to have NodeJS and the AWS CDK installed and configured. For more information, see the AWS CDK documentation.

To deploy the infrastructure, type the following commands.

# Change to the infra directory
cd infra

# Install the dependencies (only before the first deployment)
npm install 

cdk deploy

✨  Synthesis time: 2.88s
... redacted for brevity ...
Do you wish to deploy these changes (y/n)? y
... redacted for brevity ...
 ✅  LambdaApiStack

✨  Deployment time: 42.96s

Outputs:
LambdaApiStack.ApiUrl = https://tyqnjcawh0.execute-api.eu-central-1.amazonaws.com/
Stack ARN:
arn:aws:cloudformation:eu-central-1:401955065246:stack/LambdaApiStack/e0054390-be05-11ef-9504-065628de4b89

✨  Total time: 45.84s

Invoke your Lambda function

To invoke the Lambda function, use this curl command line.

curl https://tyqnjcawh0.execute-api.eu-central-1.amazonaws.com

Be sure to replace the URL with the API Gateway endpoint returned in the previous step.

This should print a JSON similar to

{"version":"2.0","rawPath":"\/","isBase64Encoded":false,"rawQueryString":"","headers":{"user-agent":"curl\/8.7.1","accept":"*\/*","host":"a5q74es3k2.execute-api.us-east-1.amazonaws.com","content-length":"0","x-amzn-trace-id":"Root=1-66fb0388-691f744d4bd3c99c7436a78d","x-forwarded-port":"443","x-forwarded-for":"81.0.0.43","x-forwarded-proto":"https"},"requestContext":{"requestId":"e719cgNpoAMEcwA=","http":{"sourceIp":"81.0.0.43","path":"\/","protocol":"HTTP\/1.1","userAgent":"curl\/8.7.1","method":"GET"},"stage":"$default","apiId":"a5q74es3k2","time":"30\/Sep\/2024:20:01:12 +0000","timeEpoch":1727726472922,"domainPrefix":"a5q74es3k2","domainName":"a5q74es3k2.execute-api.us-east-1.amazonaws.com","accountId":"012345678901"}

If you have jq installed, you can use it to pretty print the output.

curl -s  https://tyqnjcawh0.execute-api.eu-central-1.amazonaws.com | jq   
{
  "version": "2.0",
  "rawPath": "/",
  "requestContext": {
    "domainPrefix": "a5q74es3k2",
    "stage": "$default",
    "timeEpoch": 1727726558220,
    "http": {
      "protocol": "HTTP/1.1",
      "method": "GET",
      "userAgent": "curl/8.7.1",
      "path": "/",
      "sourceIp": "81.0.0.43"
    },
    "apiId": "a5q74es3k2",
    "accountId": "012345678901",
    "requestId": "e72KxgsRoAMEMSA=",
    "domainName": "a5q74es3k2.execute-api.us-east-1.amazonaws.com",
    "time": "30/Sep/2024:20:02:38 +0000"
  },
  "rawQueryString": "",
  "routeKey": "$default",
  "headers": {
    "x-forwarded-for": "81.0.0.43",
    "user-agent": "curl/8.7.1",
    "host": "a5q74es3k2.execute-api.us-east-1.amazonaws.com",
    "accept": "*/*",
    "x-amzn-trace-id": "Root=1-66fb03de-07533930192eaf5f540db0cb",
    "content-length": "0",
    "x-forwarded-proto": "https",
    "x-forwarded-port": "443"
  },
  "isBase64Encoded": false
}

Undeploy

When done testing, you can delete the infrastructure with this command.

cdk destroy

Are you sure you want to delete: LambdaApiStack (y/n)? y
LambdaApiStack: destroying... [1/1]
... redacted for brevity ...
 ✅  LambdaApiStack: destroyed

⚠️ Security and Reliability Notice

These are example applications for demonstration purposes. When deploying such infrastructure in production environments, we strongly encourage you to follow these best practices for improved security and resiliency: