Reputation: 2209
I am new to AWS and I have some secrets(ClientID and ClientSecrets) stored in dynamodb which I need to move to AWS secrets manager. What is the best way to do this? Automation is a preferred way.
Upvotes: -2
Views: 328
Reputation: 10704
You can write custom logic using the AWS SDK. You need to create 2 Service clients in the supported SDK you want to use. For example, you can implement this in Python, .NET, Java, and so on.
Now query the secrets you want to retrieve from DynamoDB by invoking the DynamoDB Service Client's query(). As you are using Python, you can use: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html.
Once you get your result set, use the data to create secrets by invoking the Secrets Manager Service Client's createSecret(). You can use: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/secretsmanager.html
To automate this, wrap this logic in an AWS Lambda function and then schedule it using a cron expression or Amazon EventBridge. For details, see:
Schedule AWS Lambda functions using EventBridge
Upvotes: 1