current_date = str(dt.now().strftime('%Y-%m-%d'))
target_cluster_snapshot_arn= current_date+'_Development_Aurora'
response = TARGET_CLIENT.copy_db_cluster_snapshot(
SourceDBClusterSnapshotIdentifier=source_cluster_snapshot_arn,
TargetDBClusterSnapshotIdentifier=target_cluster_snapshot_arn,
KmsKeyId='arn:aws:kms:us-west-2:xxxxxxx:key/axxxxxx-e326-4df2-8274-73f87ff02f37',
CopyTags=True,
Tags=[
{
'Key': 'Deletion_Date',
'Value': (dt.now() + datetime.timedelta(days=30)).strftime('%Y-%m-%d')
},
],
SourceRegion=SOURCE_REGION
)在Python中使用上面的代码时,我得到的错误是
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the CopyDBClusterSnapshot operation: Invalid cluster snapshot identifier: 2018-05-22_Development_Aurora但是,当我在TargerDBClusterSnapshotIdnetifier中硬编码值时,如下面所示,它工作得很好
response = TARGET_CLIENT.copy_db_cluster_snapshot(
SourceDBClusterSnapshotIdentifier=source_cluster_snapshot_arn,
TargetDBClusterSnapshotIdentifier='PrashastTest',
KmsKeyId='arn:aws:kms:us-west-2:xxxxxxx:key/xxxxxxb3-e326-4df2-8274-73f87ff02f37',
CopyTags=True,
Tags=[
{
'Key': 'Deletion_Date',
'Value': (dt.now() + datetime.timedelta(days=30)).strftime('%Y-%m-%d')
},
],
SourceRegion=SOURCE_REGION
)有什么线索吗?为什么会发生这种事?
发布于 2018-05-23 00:03:15
建议的快照-id在语法上无效。当您尝试对值进行硬编码时,使用了一个有效的标识符。
不允许使用下划线,标识符不能以数字开头。
下面是API引用中对快照标识符的约束:
DBClusterSnapshotIdentifier数据库集群快照的标识符。此参数存储为小写字符串。制约因素:
https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBClusterSnapshot.html
https://devops.stackexchange.com/questions/4148
复制相似问题