简体   繁体   English

我们如何使用 AWS 云形成模板创建跨区域 RDS 只读副本?

[英]How can we create cross region RDS read replica using AWS cloud formation template?

I have easily found a way to create RDS read replica in same region using AWS cloud formation, but:我很容易找到了一种使用 AWS 云形成在同一区域创建 RDS 只读副本的方法,但是:
1. Can we create the same in different region using CF template? 1.我们可以使用CF模板在不同的区域创建相同的吗?
2. Also can we promote it to primary using CF template? 2. 也可以使用CF模板将其提升为primary吗?

1) Yes, you can create a RDS read replica in different region using CloudFormation. 1) 是的,您可以使用 CloudFormation 在不同区域创建 RDS 只读副本。 Create a CloudFormation template in target region (where you want to create the read-replica) and give the source database instance arn (which is in source region) as input for SourceDBInstanceIdentifier .在目标区域(要在其中创建只读副本)创建 CloudFormation 模板,并将源数据库实例 arn (位于源区域)作为SourceDBInstanceIdentifier输入。

Resources:
  # Create Data DB
  myReplciaDB:
    Type: AWS::RDS::DBInstance
    Properties:
      DBInstanceIdentifier: "read-replica"
      PubliclyAccessible: false
      SourceDBInstanceIdentifier: "arn:aws:rds:us-east-1:XXXXXX:db:source-database"
      StorageType: gp2

Check this link for more info.查看此链接以获取更多信息。

2) Currently, I dont think it is possible to promote a read replica using cloudformation. 2) 目前,我认为使用 cloudformation 推广只读副本是不可能的。 But you can achieve this using a lambda function.但是您可以使用 lambda 函数来实现这一点。

  • Create a lambda function in the target region, which uses the promote-read-replica api in the sdk of your choice.在目标区域中创建一个 lambda 函数,该函数使用您选择的 sdk 中的promote-read-replica API。
  • Create a sns topic in the source region,and add it as a trigger for the lambda function.在源区域创建一个sns主题,并将其添加为lambda函数的触发器。 Dont forget to add invoke permission for SNS to the Lambda using the SNSTopicArn .不要忘记使用 SNSTopicArn 将 SNS 的调用权限添加到 Lambda

  • In source RDS console, Go to Event Subscription and select the sns topic arn you created above as the target arn to receive events.在源 RDS 控制台中,转到事件订阅并选择您在上面创建的sns 主题 arn作为接收事件的目标 arn。 Under event categories, select deletion, failure for you source database.在事件类别下,为您的源数据库选择deletion, failure

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我们可以使用云形成模板将RDS只读副本提升为主吗? - Can we promote RDS read replica to primary using cloud formation template? AWS RDS aurora-通过boto3或AWS CLI创建跨区域读取副本 - AWS RDS aurora - create cross region read replica - via boto3 or aws cli 有没有一种方法可以创建RDS实例的跨区域只读副本? - Is there a way to create a cross-region read only replica of an RDS instance? 如何为PostgreSQL设置AWS RDS的跨区域副本 - How to setup cross region replica of AWS RDS for PostgreSQL 我们可以将AWS RDS只读副本视为备份吗? - Can we consider AWS RDS read replica as Backup? Terraform AWS RDS 实例跨区域复制 - US-west-1 中的只读副本 - Terraform AWS RDS Instance Cross Region Replication - Read Replica in US-west-1 AWS RDS Aurora - 跨区域只读副本同时具有写入和读取实例? - AWS RDS Aurora - Cross Region Read Replica has both Write and Reader instance? 使用只读副本升级在AWS RDS MySQL数据库上创建索引 - Using Read Replica Promotion to Create Index On AWS RDS MySQL Database 我们可以在单个云形成模板中创建的资源总数是多少? - what is the total no of resources can we create in single cloud formation template? 是否可以使用 AWS PYTHON CDK 或最糟糕的 Cloud Formation 启用跨区域自动备份复制 - Is it possible to enable Cross-Region Automated Backup Replication using AWS PYTHON CDK or at worst Cloud Formation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM