我在AWS RDS上有两个数据库,一个用于stage,另一个用于跨2个帐户的production。我尝试每隔x天将production中的数据复制到stage中。我的计划是在使用来自production的共享快照在stage中创建数据库之前,在production中复制最新的自动备份快照,并将其共享给stage帐户。一切都很顺利,直到我遇到了我认为是bug的东西,但很可能是我犯了一个错误。
data "aws_db_snapshot" "latest_prod_snapshot" {
db_instance_identifier = "abcd"
snapshot_type = "shared"
include_shared = "true"
most_recent = "true"
}然后我决定尝试一下AWS CLI。当我运行这个的时候。
aws rds describe-db-snapshots --snapshot-type shared --include-shared
..。我明白了..。
{
"DBSnapshots": [
{
"MasterUsername": "root",
"LicenseModel": "general-public-license",
"InstanceCreateTime": "2018-01-13T00:00:00.000Z",
"Engine": "mysql",
"VpcId": "vpc-0000000000000000",
"SourceRegion": "us-east-1",
"AllocatedStorage": 20,
"Status": "available",
"PercentProgress": 100,
"SourceDBSnapshotIdentifier": "arn:aws:rds:us-east-1:000000000000:snapshot:rds:abcd-2020-01-13-00-00",
"DBSnapshotIdentifier": "arn:aws:rds:us-east-1:000000000000:snapshot:rds:abcd-2020-01-13-00-00",
"DBSnapshotArn": "arn:aws:rds:us-east-1:000000000000:snapshot:rds:abcd-2020-01-13-00-00",
"EngineVersion": "5.6.41",
"ProcessorFeatures": [],
"OptionGroupName": "default:mysql-5-6",
"SnapshotCreateTime": "2020-01-13T00:00:00.000Z",
"AvailabilityZone": "us-east-1b",
"StorageType": "gp2",
"Encrypted": false,
"IAMDatabaseAuthenticationEnabled": false,
"DbiResourceId": "db-AAAAAAAAAAAAAAAAAAAAAAAAA",
"SnapshotType": "shared",
"Port": 3306,
"DBInstanceIdentifier": "abcd"
}
]
}..。这正是我所期待的。查看响应,我希望db实例id为abcd,但当我运行以下命令时…
aws rds describe-db-snapshots --snapshot-type shared --include-shared --db-instance-identifier abcd
..。或者这个..。
aws rds describe-db-snapshots --snapshot-type shared --include-shared --filters Name=db-instance-id,Values=abcd
..。我明白了..。
{
"DBSnapshots": []
}..。这可不是我想要的。这是一个bug,还是我做错了什么?我浏览了他们的文档,但我可能遗漏了一些东西。
发布于 2020-02-19 01:27:02
同时我们等待AWS来解决这个问题。以下是您可以执行的一些解决方法:
stage帐户中的
2.27为我工作
provider "aws" {
version = "2.27.0"
}发布于 2021-09-29 07:59:18
根据亚马逊网络服务支持,DBInstanceIdentifier仅用于显示呼叫客户拥有的快照的结果,因此不会返回共享快照的结果。为了使用查询仅筛选和显示共享快照,可以使用-- DBInstanceIdentifier按DBInstanceIdentifier值进行筛选:
aws rds describe-db-snapshots --snapshot-type shared --include-shared --query "DBSnapshots[?DBInstanceIdentifier=='abcd']" https://stackoverflow.com/questions/60085106
复制相似问题