AWS中如何为SQLServer凭据创建旋转性密钥?
创始人
2024-09-28 04:30:21
0

在AWS上为SQL Server凭据创建旋转性密钥的步骤如下:

  1. 创建存储凭据的Vault:
import boto3

client = boto3.client('secretsmanager', region_name='us-west-2')

resp = client.create_secret(
        Name="MyTestDatabaseSecret",
        Description="Test database credentials",
        SecretString='{"username":"dbAdmin","password":"password"}', # put database credentials here
        Tags=[
            {
                'Key': 'mykey',
                'Value': 'myvalue'
            },
        ],
        RecoveryWindowInDays=7,
        KmsKeyId="",
        ForceOverwriteSecret=True)

print(resp)
  1. 创建旋转性策略:
import boto3

client = boto3.client('secretsmanager', region_name='us-west-2')

resp = client.create_secret(
        Name="MyTestDatabaseSecret",
        Description="Test database credentials",
        SecretString='{"username":"dbAdmin","password":"password"}', # put database credentials here
        Tags=[
            {
                'Key': 'mykey',
                'Value': 'myvalue'
            },
        ],
        RotationLambdaARN="arn:aws:lambda:us-west-2:123456789012:function:MyTestFunction",
        RotationRules={
            'AutomaticallyAfterDays': 30
        },
        KmsKeyId="",
        ForceOverwriteSecret=False)

print(resp)

这里的RotationLambdaARN是用于旋转凭据的Lambda函数的ARN。RotationRules中的‘AutomaticallyAfterDays’字段指定了在多少天后自动进行凭证轮换。

  1. 启用旋转策略:
import boto3

client = boto3.client('secretsmanager', region_name='us-west-2')

response = client.rotate_secret(
    SecretId='MyTestDatabaseSecret',
    RotationLambdaARN='arn:aws:lambda:us-west-2:123456789012:function:MyTestFunction',
    RotationRules={
        'AutomaticallyAfterDays': 30
    })

print(response)

这样

相关内容

热门资讯

查到实测!wejoker透视方... 查到实测!wejoker透视方法,hhpoker辅助软件是真的么,AI教程(有挂透视);1.hhpo...
透视工具!we-poker辅助... 透视工具!we-poker辅助软件教程(透视)一直真的有挂(详细辅助曝光教程)辅助器中分为三种模型:...
玩家必备教程!wepoker透... 玩家必备教程!wepoker透视脚本免费app,we-poker软件,攻略教程(有挂方法)1、玩家可...
透视ai代打!werplan透... 透视ai代打!werplan透视挂(透视)好像存在有挂(详细辅助揭秘教程)1、在ai机器人技巧中,中...
分享认知!wepoker的辅助... 分享认知!wepoker的辅助器,来玩app 德州 辅助,切实教程(有挂方法)是由北京得来玩app ...
透视免费!wepoker作弊视... 透视免费!wepoker作弊视频(透视)确实有挂(详细辅助微扑克教程)1、透视辅助简单,软件透明挂操...
实操分享!wepoker新号好... 实操分享!wepoker新号好一点吗,wepokerplus脚本,2025新版教程(有挂教程)关于w...
透视总结!wepoker黑侠辅... 透视总结!wepoker黑侠辅助器正版下载(透视)一贯有挂(详细辅助解密教程)1、进入游戏-大厅左侧...
推荐十款!hhpoker透视方... 1、推荐十款!hhpoker透视方法,wepoker究竟有没有透视,2025新版(有挂辅助);详细教...
透视透视!hhpoker智能辅... 透视透视!hhpoker智能辅助插件(透视)切实有挂(详细辅助必胜教程)1、起透看视 透明视辅助2、...