Skip to content

Commit b7027fc

Browse files
authored
Upgrade to AWS SDK for Javascript V3 (#158)
* Upgrade to AWS SDK for Javascript V3 * prerelease * Update node versions * Update default lambda runtime * Only include node 20, 22 * Updating cfn-lint and aws-sam dev deps * Updating fixtures * Get ready for release * prerelease time * Getting ready for release
1 parent a45f2e6 commit b7027fc

36 files changed

+2797
-950
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
test:
1212
strategy:
1313
matrix:
14-
node-version: [14, 16, 18]
14+
node-version: [20, 22]
1515
runs-on: ubuntu-22.04
1616
permissions:
1717
id-token: write
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v4
2121
- uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.7.17'
23+
python-version: '3.12.7'
2424
- name: pip install
2525
run: |
2626
pip install -r requirements.dev.txt

changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## 9.0.0
4+
5+
- Removes:
6+
- aws-sdk as a runtime dependency.
7+
- All node support prior to version 20.
8+
- Adds:
9+
- `@aws-sdk/client-cloudformation` as a runtime dependency.
10+
- Updates:
11+
- bin/validate-template to use `@aws-sdk/client-cloudformation`.
12+
- Lambda shortcut lambda runtime default to use `node22.x`
13+
314
## 8.4.0
415

516
- Support `ImageConfig` property for Lambda

lib/shortcuts/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ Log Group, a Role, an Alarm on function errors, and the Lambda Function itself.
401401
| [options.Layers] | <code>Array.&lt;String&gt;</code> | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-layers). |
402402
| [options.MemorySize] | <code>Number</code> | <code>128</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-memorysize). |
403403
| [options.ReservedConcurrentExecutions] | <code>Number</code> | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-reservedconcurrentexecutions). |
404-
| [options.Runtime] | <code>String</code> | <code>&#x27;nodejs18.x&#x27;</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime). |
404+
| [options.Runtime] | <code>String</code> | <code>&#x27;nodejs22.x&#x27;</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime). |
405405
| [options.Tags] | <code>Array.&lt;Object&gt;</code> | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-tags). |
406406
| [options.Timeout] | <code>Number</code> | <code>300</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-timeout). |
407407
| [options.TracingConfig] | <code>Object</code> | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-tracingconfig). |

lib/shortcuts/lambda.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const ServiceRole = require('./service-role');
2222
* @param {Array<String>} [options.Layers=undefined] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-layers).
2323
* @param {Number} [options.MemorySize=128] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-memorysize).
2424
* @param {Number} [options.ReservedConcurrentExecutions=undefined] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-reservedconcurrentexecutions).
25-
* @param {String} [options.Runtime='nodejs18.x'] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime).
25+
* @param {String} [options.Runtime='nodejs22.x'] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-runtime).
2626
* @param {Array<Object>} [options.Tags=undefined] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-tags).
2727
* @param {Number} [options.Timeout=300] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-timeout).
2828
* @param {Object} [options.TracingConfig=undefined] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-tracingconfig).
@@ -81,7 +81,7 @@ class Lambda {
8181
Layers,
8282
MemorySize = 128,
8383
ReservedConcurrentExecutions,
84-
Runtime = 'nodejs18.x',
84+
Runtime = 'nodejs22.x',
8585
Tags,
8686
Timeout = 300,
8787
TracingConfig,

lib/validate.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

3-
require('aws-sdk/lib/maintenance_mode_message').suppress = true;
4-
const AWS = require('aws-sdk');
3+
const { CloudFormationClient, ValidateTemplateCommand } = require('@aws-sdk/client-cloudformation');
54
const build = require('./build');
65

76
/**
@@ -16,9 +15,9 @@ const build = require('./build');
1615
* reject if it is not.
1716
*/
1817
module.exports = (templatePath, region) => {
19-
const cfn = new AWS.CloudFormation({ region: region || 'us-east-1' });
18+
const cfn = new CloudFormationClient({ region: region || 'us-east-1' });
2019

2120
return build(templatePath, { region: region || 'us-east-1' }).then((template) => {
22-
return cfn.validateTemplate({ TemplateBody: JSON.stringify(template) }).promise();
21+
return cfn.send(new ValidateTemplateCommand({ TemplateBody: JSON.stringify(template) }));
2322
});
2423
};

0 commit comments

Comments
 (0)