- Newest
- Most votes
- Most comments
To use SSL with AWS Database Migration Service (DMS), you need to provide a certificate to establish a secure connection. Your approach of downloading the RDS CA certificate bundle and storing it in SSM or Secrets Manager is a good practice to avoid committing certificates to your code repository.
Your Lambda function for downloading the region-specific RDS CA certificate bundle looks correct. It attempts to download the region-specific bundle first, and if that fails, it falls back to the global bundle.
After downloading the certificate, you'll need to import it into AWS DMS using the aws dms import-certificate command. This can be done within your Lambda function after downloading the certificate:
import boto3 # After downloading the certificate with open(bundle_path, 'r') as cert_file: cert_content = cert_file.read() # Import certificate to DMS dms_client = boto3.client('dms') response = dms_client.import-certificate( CertificateIdentifier='rds-ca-cert', CertificatePem=cert_content ) # Get the certificate ARN certificate_arn = response['Certificate']['CertificateArn'] # Store the ARN in SSM Parameter Store or Secrets Manager ssm_client = boto3.client('ssm') ssm_client.put_parameter( Name='/dms/certificate/arn', Value=certificate_arn, Type='String', Overwrite=True )
Then in your CDK code, you can retrieve the certificate ARN from SSM:
// In your CDK code const certificateArn = ssm.StringParameter.valueForStringParameter( this, '/dms/certificate/arn' ); // Use the certificate ARN in your DMS task const dmsTask = new dms.CfnReplicationTask(this, 'DmsTask', { // other properties replicationTaskSettings: JSON.stringify({ // other settings TargetMetadata: { SslMode: 'verify-full', CertificateArn: certificateArn } }) });
When configuring your DMS endpoint, you would reference this certificate ARN and set the SSL mode to "verify-full" to ensure secure connections. This approach allows you to use SSL with your DMS task without committing the certificate file to your repository.
Sources
Using Amazon DocumentDB as a target for AWS Database Migration Service - AWS Database Migration Service
Using SSL with AWS Database Migration Service - AWS Database Migration Service
answered 9 months ago
Relevant content
asked 9 months ago
asked 9 months ago
asked 9 months ago
