diff --git a/deploy_autotag.sh b/deploy_autotag.sh index a655e65..f7361fc 100755 --- a/deploy_autotag.sh +++ b/deploy_autotag.sh @@ -16,8 +16,7 @@ function build-package () { npm run compile cp package.json lib/ - npm install --prefix lib/ --production - # rm -rf lib/node_modules/aws-sdk + npm install --no-optional --omit=dev --prefix lib/ ( cd lib diff --git a/package.json b/package.json index bde884f..ed5b8d5 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,27 @@ "main": "autotag.js", "private": true, "dependencies": { - "aws-sdk": "^2.493.0", "babel-polyfill": "^6.7.4", "lodash": "^4.17.14" }, + "optionalDependencies": { + "@aws-sdk/client-auto-scaling": "^3.410.0", + "@aws-sdk/client-cloudwatch": "^3.410.0", + "@aws-sdk/client-cloudwatch-events": "^3.410.0", + "@aws-sdk/client-cloudwatch-logs": "^3.410.0", + "@aws-sdk/client-data-pipeline": "^3.410.0", + "@aws-sdk/client-dynamodb": "^3.410.0", + "@aws-sdk/client-ec2": "^3.410.0", + "@aws-sdk/client-elastic-load-balancing": "^3.410.0", + "@aws-sdk/client-elastic-load-balancing-v2": "^3.410.0", + "@aws-sdk/client-emr": "^3.410.0", + "@aws-sdk/client-iam": "^3.410.0", + "@aws-sdk/client-lambda": "^3.410.0", + "@aws-sdk/client-opsworks": "^3.410.0", + "@aws-sdk/client-rds": "^3.410.0", + "@aws-sdk/client-s3": "^3.410.0", + "@aws-sdk/client-sts": "^3.410.0" + }, "devDependencies": { "@babel/cli": "^7.5.0", "@babel/core": "^7.5.4", diff --git a/src/aws_cloud_trail_log_listener.js b/src/aws_cloud_trail_log_listener.js index 41df391..142ed2b 100644 --- a/src/aws_cloud_trail_log_listener.js +++ b/src/aws_cloud_trail_log_listener.js @@ -1,5 +1,5 @@ import zlib from 'zlib.js'; -import AWS from 'aws-sdk.js'; +import { S3 } from "@aws-sdk/client-s3"; import each from 'lodash/each.js'; import constants from './cloud_trail_event_config.js'; import AutotagFactory from './autotag_factory.js'; @@ -10,7 +10,7 @@ class AwsCloudTrailLogListener { this.cloudtrailEvent = cloudtrailEvent; this.applicationContext = applicationContext; this.enabledServices = enabledServices; - this.s3 = new AWS.S3(); + this.s3 = new S3(); this.s3Region = ''; } diff --git a/src/workers/autotag_ami_worker.js b/src/workers/autotag_ami_worker.js index 2396e49..2c26759 100644 --- a/src/workers/autotag_ami_worker.js +++ b/src/workers/autotag_ami_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagAMIWorker extends AutotagEC2Worker { @@ -12,7 +12,7 @@ class AutotagAMIWorker extends AutotagEC2Worker { const resourceIds = []; const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_autoscale_worker.js b/src/workers/autotag_autoscale_worker.js index ee67b16..6aaac37 100644 --- a/src/workers/autotag_autoscale_worker.js +++ b/src/workers/autotag_autoscale_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { AutoScaling } from "@aws-sdk/client-auto-scaling"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagAutoscaleWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagAutoscaleWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.autoscaling = new AWS.AutoScaling({ + this.autoscaling = new AutoScaling({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_customer_gateway_worker.js b/src/workers/autotag_customer_gateway_worker.js index 0e739d6..0d5beb9 100644 --- a/src/workers/autotag_customer_gateway_worker.js +++ b/src/workers/autotag_customer_gateway_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagCustomerGatewayWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagCustomerGatewayWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_cw_alarm_worker.js b/src/workers/autotag_cw_alarm_worker.js index ec169ea..d0caa1e 100644 --- a/src/workers/autotag_cw_alarm_worker.js +++ b/src/workers/autotag_cw_alarm_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { CloudWatch } from "@aws-sdk/client-cloudwatch"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagCloudwatchAlarmWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagCloudwatchAlarmWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.cloudwatch = new AWS.CloudWatch({ + this.cloudwatch = new CloudWatch({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_cw_events_rule_worker.js b/src/workers/autotag_cw_events_rule_worker.js index 6c91456..ff8e5f6 100644 --- a/src/workers/autotag_cw_events_rule_worker.js +++ b/src/workers/autotag_cw_events_rule_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { CloudWatchEvents } from "@aws-sdk/client-cloudwatch-events"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagCloudwatchEventsRuleWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagCloudwatchEventsRuleWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.cloudwatchEvents = new AWS.CloudWatchEvents({ + this.cloudwatchEvents = new CloudWatchEvents({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_cw_loggroup_worker.js b/src/workers/autotag_cw_loggroup_worker.js index 436facf..5cb403e 100644 --- a/src/workers/autotag_cw_loggroup_worker.js +++ b/src/workers/autotag_cw_loggroup_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { CloudWatchLogs } from "@aws-sdk/client-cloudwatch-logs"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagCloudwatchLogGroupWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagCloudwatchLogGroupWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.cloudwatchLogs = new AWS.CloudWatchLogs({ + this.cloudwatchLogs = new CloudWatchLogs({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_data_pipeline_worker.js b/src/workers/autotag_data_pipeline_worker.js index 1acbb04..048c88a 100644 --- a/src/workers/autotag_data_pipeline_worker.js +++ b/src/workers/autotag_data_pipeline_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { DataPipeline } from "@aws-sdk/client-data-pipeline"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagDataPipelineWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagDataPipelineWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.dataPipeline = new AWS.DataPipeline({ + this.dataPipeline = new DataPipeline({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_default_worker.js b/src/workers/autotag_default_worker.js index af9c153..b4a60ac 100644 --- a/src/workers/autotag_default_worker.js +++ b/src/workers/autotag_default_worker.js @@ -1,5 +1,5 @@ import get from 'lodash/get.js'; -import * as AWS from 'aws-sdk'; +import { STS } from "@aws-sdk/client-sts"; import SETTINGS from '../autotag_settings.js'; export const AUTOTAG_TAG_NAME_PREFIX = 'AutoTag_'; @@ -45,10 +45,9 @@ class AutotagDefaultWorker { assumeRole(roleName) { return new Promise((resolve, reject) => { try { - AWS.config.region = 'us-east-1'; //Uncomment line below for AWS STS logging //AWS.config.logger = console; - const sts = new AWS.STS(); + const sts = new STS(); sts.assumeRole({ RoleArn: this.getAssumeRoleArn(roleName), RoleSessionName: `AutoTag-${(new Date()).getTime()}`, diff --git a/src/workers/autotag_dhcp_options_worker.js b/src/workers/autotag_dhcp_options_worker.js index 9f2d14e..63c2d0d 100644 --- a/src/workers/autotag_dhcp_options_worker.js +++ b/src/workers/autotag_dhcp_options_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagDhcpOptionsWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagDhcpOptionsWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_dynamodb_worker.js b/src/workers/autotag_dynamodb_worker.js index 646482b..d123883 100644 --- a/src/workers/autotag_dynamodb_worker.js +++ b/src/workers/autotag_dynamodb_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { DynamoDB } from "@aws-sdk/client-dynamodb"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagDynamoDBWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagDynamoDBWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.dynamoDB = new AWS.DynamoDB({ + this.dynamoDB = new DynamoDB({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_ebs_worker.js b/src/workers/autotag_ebs_worker.js index 4532dad..8ab298a 100644 --- a/src/workers/autotag_ebs_worker.js +++ b/src/workers/autotag_ebs_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagEBSWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagEBSWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_ec2_worker.js b/src/workers/autotag_ec2_worker.js index 16401f4..3295078 100644 --- a/src/workers/autotag_ec2_worker.js +++ b/src/workers/autotag_ec2_worker.js @@ -1,4 +1,6 @@ -import AWS from 'aws-sdk'; +import { AutoScaling } from "@aws-sdk/client-auto-scaling"; +import { EC2 } from "@aws-sdk/client-ec2"; +import { OpsWorks } from "@aws-sdk/client-opsworks"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagEC2Worker extends AutotagDefaultWorker { @@ -14,13 +16,13 @@ class AutotagEC2Worker extends AutotagDefaultWorker { let parentTags; let opsworksInstances; - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); if (this.isInvokedByAutoscaling()) { - this.autoscaling = new AWS.AutoScaling({ + this.autoscaling = new AutoScaling({ region: this.event.awsRegion, credentials }); @@ -30,7 +32,7 @@ class AutotagEC2Worker extends AutotagDefaultWorker { } if (this.isInvokedByOpsworks()) { - this.opsworks = new AWS.OpsWorks({ + this.opsworks = new OpsWorks({ region: this.event.awsRegion, credentials }); @@ -39,7 +41,7 @@ class AutotagEC2Worker extends AutotagDefaultWorker { } catch (err) { if (err.name === 'ResourceNotFoundException') { // switch to the main OpsWorks region and try again - this.opsworks = new AWS.OpsWorks({ + this.opsworks = new OpsWorks({ region: 'us-east-1', credentials }); diff --git a/src/workers/autotag_eip_worker.js b/src/workers/autotag_eip_worker.js index 0803a8c..b0542df 100644 --- a/src/workers/autotag_eip_worker.js +++ b/src/workers/autotag_eip_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagEIPWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagEIPWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_elb_worker.js b/src/workers/autotag_elb_worker.js index 6199e38..1f27564 100644 --- a/src/workers/autotag_elb_worker.js +++ b/src/workers/autotag_elb_worker.js @@ -1,4 +1,5 @@ -import AWS from 'aws-sdk'; +import { ElasticLoadBalancing as ELB } from "@aws-sdk/client-elastic-load-balancing"; +import { ElasticLoadBalancingV2 as ELBv2 } from "@aws-sdk/client-elastic-load-balancing-v2"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagELBWorker extends AutotagDefaultWorker { @@ -12,13 +13,13 @@ class AutotagELBWorker extends AutotagDefaultWorker { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); if (this.isLoadBalancerV2()) { - this.elbv2 = new AWS.ELBv2({ + this.elbv2 = new ELBv2({ region: this.event.awsRegion, credentials }); await this.tagELBV2Resource(); } else { - this.elb = new AWS.ELB({ + this.elb = new ELB({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_emr_worker.js b/src/workers/autotag_emr_worker.js index aaf5e5d..31c380f 100644 --- a/src/workers/autotag_emr_worker.js +++ b/src/workers/autotag_emr_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EMR } from "@aws-sdk/client-emr"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagEMRWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagEMRWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.emr = new AWS.EMR({ + this.emr = new EMR({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_eni_worker.js b/src/workers/autotag_eni_worker.js index 0178a59..1eb29db 100644 --- a/src/workers/autotag_eni_worker.js +++ b/src/workers/autotag_eni_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagENIWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagENIWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_iam_role_worker.js b/src/workers/autotag_iam_role_worker.js index ba09ea8..de0e602 100644 --- a/src/workers/autotag_iam_role_worker.js +++ b/src/workers/autotag_iam_role_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { IAM } from "@aws-sdk/client-iam"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagIAMRoleWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagIAMRoleWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.iam = new AWS.IAM({ + this.iam = new IAM({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_iam_user_worker.js b/src/workers/autotag_iam_user_worker.js index 467910a..62d2755 100644 --- a/src/workers/autotag_iam_user_worker.js +++ b/src/workers/autotag_iam_user_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { IAM } from "@aws-sdk/client-iam"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagIAMUserWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagIAMUserWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.iam = new AWS.IAM({ + this.iam = new IAM({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_internet_gateway_worker.js b/src/workers/autotag_internet_gateway_worker.js index 24b283e..d3f3c45 100644 --- a/src/workers/autotag_internet_gateway_worker.js +++ b/src/workers/autotag_internet_gateway_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagInternetGatewayWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagInternetGatewayWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_lambda_function_worker.js b/src/workers/autotag_lambda_function_worker.js index 09cac46..0702448 100644 --- a/src/workers/autotag_lambda_function_worker.js +++ b/src/workers/autotag_lambda_function_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { Lambda } from "@aws-sdk/client-lambda"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagLambdaFunctionWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagLambdaFunctionWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.lambda = new AWS.Lambda({ + this.lambda = new Lambda({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_nat_gateway_worker.js b/src/workers/autotag_nat_gateway_worker.js index 1ec0968..1c56b83 100644 --- a/src/workers/autotag_nat_gateway_worker.js +++ b/src/workers/autotag_nat_gateway_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagNATGatewayWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagNATGatewayWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_network_acl_worker.js b/src/workers/autotag_network_acl_worker.js index f5827f8..a04d54c 100644 --- a/src/workers/autotag_network_acl_worker.js +++ b/src/workers/autotag_network_acl_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagNetworkACLWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagNetworkACLWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_opsworks_worker.js b/src/workers/autotag_opsworks_worker.js index 3dfaaaa..4a0171c 100644 --- a/src/workers/autotag_opsworks_worker.js +++ b/src/workers/autotag_opsworks_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { OpsWorks } from "@aws-sdk/client-opsworks"; import AutotagDefaultWorker from './autotag_default_worker.js'; class AutotagOpsworksWorker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagOpsworksWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.opsworks = new AWS.OpsWorks({ + this.opsworks = new OpsWorks({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_rds_worker.js b/src/workers/autotag_rds_worker.js index 7e0d4b5..5aadc3b 100644 --- a/src/workers/autotag_rds_worker.js +++ b/src/workers/autotag_rds_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { RDS } from "@aws-sdk/client-rds"; import AutotagDefaultWorker from './autotag_default_worker.js'; @@ -12,7 +12,7 @@ class AutotagRDSWorker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.rds = new AWS.RDS({ + this.rds = new RDS({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_route_table_worker.js b/src/workers/autotag_route_table_worker.js index 8b39c60..41244fd 100644 --- a/src/workers/autotag_route_table_worker.js +++ b/src/workers/autotag_route_table_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagRouteTableWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagRouteTableWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_s3_worker.js b/src/workers/autotag_s3_worker.js index 93f91f6..c3e580a 100644 --- a/src/workers/autotag_s3_worker.js +++ b/src/workers/autotag_s3_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { S3 } from "@aws-sdk/client-s3"; import AutotagDefaultWorker, { AUTOTAG_TAG_NAME_PREFIX } from './autotag_default_worker.js'; class AutotagS3Worker extends AutotagDefaultWorker { @@ -11,7 +11,7 @@ class AutotagS3Worker extends AutotagDefaultWorker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.s3 = new AWS.S3({ + this.s3 = new S3({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_security_group_worker.js b/src/workers/autotag_security_group_worker.js index 84f96b1..da5ce4c 100644 --- a/src/workers/autotag_security_group_worker.js +++ b/src/workers/autotag_security_group_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagSecurityGroupWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagSecurityGroupWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_snapshot_worker.js b/src/workers/autotag_snapshot_worker.js index 14d9043..ace90fe 100644 --- a/src/workers/autotag_snapshot_worker.js +++ b/src/workers/autotag_snapshot_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagSnapshotWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagSnapshotWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_subnet_worker.js b/src/workers/autotag_subnet_worker.js index ca1e196..6d669f3 100644 --- a/src/workers/autotag_subnet_worker.js +++ b/src/workers/autotag_subnet_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagSubnetWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagSubnetWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_vpc_peering_worker.js b/src/workers/autotag_vpc_peering_worker.js index 8019de2..9996c64 100644 --- a/src/workers/autotag_vpc_peering_worker.js +++ b/src/workers/autotag_vpc_peering_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagVPCPeeringWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagVPCPeeringWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_vpc_worker.js b/src/workers/autotag_vpc_worker.js index 8badcb1..faf5262 100644 --- a/src/workers/autotag_vpc_worker.js +++ b/src/workers/autotag_vpc_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagVPCWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagVPCWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_vpn_connection_worker.js b/src/workers/autotag_vpn_connection_worker.js index 68071a3..40814c0 100644 --- a/src/workers/autotag_vpn_connection_worker.js +++ b/src/workers/autotag_vpn_connection_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagVPNConnectionWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagVPNConnectionWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials }); diff --git a/src/workers/autotag_vpn_gateway_worker.js b/src/workers/autotag_vpn_gateway_worker.js index fedd652..7f2baea 100644 --- a/src/workers/autotag_vpn_gateway_worker.js +++ b/src/workers/autotag_vpn_gateway_worker.js @@ -1,4 +1,4 @@ -import AWS from 'aws-sdk'; +import { EC2 } from "@aws-sdk/client-ec2"; import AutotagEC2Worker from './autotag_ec2_worker.js'; class AutotagVPNGatewayWorker extends AutotagEC2Worker { @@ -11,7 +11,7 @@ class AutotagVPNGatewayWorker extends AutotagEC2Worker { async tagResource() { const roleName = this.roleName; const credentials = await this.assumeRole(roleName); - this.ec2 = new AWS.EC2({ + this.ec2 = new EC2({ region: this.event.awsRegion, credentials });