Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable */
/**
* Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
import { ConfigServiceClient, DeleteConfigurationAggregatorCommand } from '@aws-sdk/client-config-service';
import { Credentials } from '@aws-sdk/client-sts';
import { throttlingBackOff } from './backoff';

export class ConfigService {
private readonly serviceClient: ConfigServiceClient;

constructor(credentials?: Credentials, region?: string) {
if (credentials) {
this.serviceClient = new ConfigServiceClient({ credentials: {
accessKeyId: credentials.AccessKeyId!,
secretAccessKey: credentials.SecretAccessKey!,
sessionToken: credentials.SessionToken! },
region });
} else {
this.serviceClient = new ConfigServiceClient({});
}
}

async deleteConfigAggregator(acceleratorPrefix: string): Promise<void> {
try {
await throttlingBackOff(() => this.serviceClient.send(new DeleteConfigurationAggregatorCommand({ ConfigurationAggregatorName: `${acceleratorPrefix}Config-Org-Aggregator` })));
} catch (error) {
console.log('No Org Aggregator found');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import path from 'path';
import { AcceleratorConfig, ImportCertificateConfig, ImportCertificateConfigType } from './asea-config';
import { loadAseaConfig } from './asea-config/load';
import { DynamoDB } from './common/aws/dynamodb';
import { ConfigService } from './common/aws/config-service';
import { S3 } from './common/aws/s3';
import { Account, getAccountId } from './common/outputs/accounts';
import { StackOutput, findValuesFromOutputs, loadOutputs } from './common/outputs/load-outputs';
Expand All @@ -30,6 +31,7 @@ export class PostMigration {
private readonly aseaPrefix: string;
private readonly s3: S3;
private readonly dynamoDb: DynamoDB;
private readonly configService: ConfigService;
private outputs: StackOutput[] = [];
private accounts: Account[] = [];
private centralBucket: string | undefined;
Expand All @@ -48,6 +50,7 @@ export class PostMigration {
this.mappingRepositoryName = config.mappingRepositoryName;
this.s3 = new S3(undefined, this.region);
this.dynamoDb = new DynamoDB(undefined, this.region);
this.configService = new ConfigService(undefined, this.region);
this.args = args;
this.outputsDirectory = './outputs';
this.writeConfig = {
Expand Down Expand Up @@ -375,6 +378,7 @@ export class PostMigration {
phase: '3',
resourceType: 'AWS::Config::RemediationConfiguration',
});
await this.configService.deleteConfigAggregator(this.aseaPrefix);
}

private async removeLogging(mappingConfig: { mappings: ASEAResourceMapping; mappingBucket: string; s3Client: S3 }) {
Expand Down