首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >极光快照的跨区域拷贝

极光快照的跨区域拷贝
EN

DevOps用户
提问于 2018-05-22 20:22:58
回答 1查看 239关注 0票数 2
代码语言:javascript
复制
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中使用上面的代码时,我得到的错误是

代码语言:javascript
复制
botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the CopyDBClusterSnapshot operation: Invalid cluster snapshot identifier:  2018-05-22_Development_Aurora

但是,当我在TargerDBClusterSnapshotIdnetifier中硬编码值时,如下面所示,它工作得很好

代码语言:javascript
复制
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
)

有什么线索吗?为什么会发生这种事?

EN

回答 1

DevOps用户

回答已采纳

发布于 2018-05-23 00:03:15

建议的快照-id在语法上无效。当您尝试对值进行硬编码时,使用了一个有效的标识符。

不允许使用下划线,标识符不能以数字开头。

下面是API引用中对快照标识符的约束:

DBClusterSnapshotIdentifier数据库集群快照的标识符。此参数存储为小写字符串。制约因素:

  • 必须包含1到63个字母、数字或连字符。
  • 第一个字符必须是一个字母。
  • 不能以连字符结尾或包含两个连续连字符。

https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBClusterSnapshot.html

票数 2
EN
页面原文内容由DevOps提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://devops.stackexchange.com/questions/4148

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档