我在 AWS RDS 上有 2 个数据库,其中一个用于stage
和一个用于production
跨 2 个帐户。我正在尝试将数据复制到production
to stage
每 x 天。我的计划是复制最近的自动备份快照production
并分享给stage
创建数据库之前的帐户stage
使用来自的共享快照production
。一切都很顺利,直到我遇到了一个我认为是错误的东西,但很可能是我犯了一个错误。
当我尝试获取 id 为的最新共享快照时abcd
在 Terraform 中data "aws_db_snapshot"
,我没有结果。
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"
}
]
}
...这正是我所期望的。查看响应,我希望数据库实例 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": []
}
……这不是我所期望的。这是一个错误还是我做错了什么?我浏览了他们的文档,但我可能错过了一些东西。