Skip to content

Commit

Permalink
Merge pull request #26686 from guardian/mxdvl/aws-sdk-js-codemod
Browse files Browse the repository at this point in the history
Migrate AWS JS SDK to v2
  • Loading branch information
mxdvl authored Nov 13, 2023
2 parents b56d4b6 + b33d2c0 commit 6c2f94b
Show file tree
Hide file tree
Showing 3 changed files with 849 additions and 143 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"unset-value": "^2.0.1"
},
"devDependencies": {
"@aws-sdk/client-cloudwatch": "3.441.0",
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.4",
Expand All @@ -84,7 +85,6 @@
"amphtml-validator": "^1.0.21",
"any-observable": "^0.2.0",
"autoprefixer": "^10.3.7",
"aws-sdk": "^2.411.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.3.0",
Expand Down
22 changes: 11 additions & 11 deletions tools/asset-monitor/cloudwatch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require('fs');
const AWS = require('aws-sdk');
const { CloudWatch } = require('@aws-sdk/client-cloudwatch');

let cloudwatch;

Expand All @@ -19,17 +19,17 @@ module.exports.configure = filename =>
);
}

AWS.config.update({
region: 'eu-west-1',
accessKeyId: module.exports.getProperty('aws.access.key', data),
secretAccessKey: module.exports.getProperty(
'aws.access.secret.key',
data
),
});

try {
cloudwatch = new AWS.CloudWatch();
cloudwatch = new CloudWatch({
region: 'eu-west-1',
credentials: {
accessKeyId: module.exports.getProperty('aws.access.key', data),
secretAccessKey: module.exports.getProperty(
'aws.access.secret.key',
data
),
},
});
return resolve({});
} catch (e) {
return reject(e);
Expand Down
Loading

0 comments on commit 6c2f94b

Please sign in to comment.