AWS Elastic Beanstalk 更改 RDS 端点 [英] AWS Elastic Beanstalk change RDS Endpoint

查看:29
本文介绍了AWS Elastic Beanstalk 更改 RDS 端点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改 AWS Elastic Beanstalk 环境的已配置 RDS 终端节点?例如.RDS 数据库删除后或应更换为新的 RDS 数据库.

How do I change the configured RDS endpoint of an AWS Elastic Beanstalk environment? E.g. after the RDS database was deleted or should be replaced with a new RDS database.

推荐答案

更新

该主题仍然很复杂,AWS Elastic Beanstalk (EB) 文档仍然可以更好地阐明可用选项.问题是关于如何更改 RDS 端点,这似乎有两种不同的解读方式:

Update

The topic remains complex and the AWS Elastic Beanstalk (EB) documentation could still do a better job to clarify available options. The question has been about how to change an RDS endpoint, which seems to be read in two different ways:

  1. 人们可以解释如何将现有的外部管理的 RDS 端点附加到现有的(不是新的!)EB 环境 - 这确实是不可能的,而是需要求助于处理这个问题来自应用程序本身的场景,例如在中的使用现有的 Amazon RDS 数据库实例与 Python 部分概述将 Amazon RDS 与 Python 结合使用.
  2. 相反,OP 询问如何在删除 RDS 数据库或应替换为新的 RDS 数据库后执行此操作,即 RDS 端点更改隐含在为已有的现有 EB 环境创建新的 RDS 数据库 - 这确实可以通过 DBSnapshotIdentifier 选项值,表示要从中恢复的数据库快照的标识符.EB 文档并没有完全确定这意味着什么,但是,EB 在幕后使用了 AWS CloudFormation,并且分别AWS::RDS 的条目::DBInstance - DBSnapshotIdentifier 提供了更多详细信息:
  1. One could interpret it about how to attach an existing externally managed RDS endpoint to an existing (not new!) EB environment - this is indeed not possible, rather one would need to resort to handling this scenario from within the app itself as e.g. outlined in section Using an Existing Amazon RDS DB Instance with Python within Using Amazon RDS with Python.
  2. Rather, the OP asked about how to do that after the RDS database was deleted or should be replaced with a new RDS database, i.e. the RDS endpoint change is implied in the process of creating a new RDS database for an existing EB environment that already had one - this is indeed possible by means of the DBSnapshotIdentifier Option Value, which denotes The identifier for the DB snapshot to restore from. Once again the EB docs aren't exactly conclusive what this means, however, EB is using AWS CloudFormation under the hood, and the resp. entry for AWS::RDS::DBInstance - DBSnapshotIdentifier provides more details:

通过指定此属性,您可以从指定的数据库快照.如果 DBSnapshotIdentifier 属性是空字符串或 AWS::RDS::DBInstance 声明没有DBSnapshotIdentifier 属性,数据库被创建为一个新的数据库.如果该属性包含一个值(空字符串除外),AWS CloudFormation 从指定的快照创建数据库.如果指定名称的快照不存在,数据库创建失败,堆栈回滚.

By specifying this property, you can create a DB instance from the specified DB snapshot. If the DBSnapshotIdentifier property is an empty string or the AWS::RDS::DBInstance declaration has no DBSnapshotIdentifier property, the database is created as a new database. If the property contains a value (other than empty string), AWS CloudFormation creates a database from the specified snapshot. If a snapshot with the specified name does not exist, the database creation fails and the stack rolls back.

换句话说,更新任何 General Option 的典型结果来自命名空间 aws:rds:dbinstance 的值对于现有的 EB 环境是创建一个由 EB 管理的分别调整的 RDS 实例,因此是一个新的 RDS 端点.

In other words, the typical result of updating any of the General Option Values from namespace aws:rds:dbinstance for an existing EB environment is the creation of a respectively adjusted RDS instance managed by EB, and thus a new RDS endpoint.

  • 一个特定的子场景是使用DBSnapshotIdentifier,它基于引用的快照生成一个由EB管理的新RDS实例,因此可用于迁移(而不是而不是附加)一个现有的外部管理的 RDS 实例,尽管根据快照大小会有相当长的停机时间.
    • A specific sub scenario is the use of DBSnapshotIdentifier, which yields a new RDS instance managed by EB based on the referenced snapshot and can therefore be used to migrate (rather than attach) an existing externally managed RDS instance, albeit with considerable downtime based on the snapshot size.
    • 不幸的是,使用 AWS Elastic Beanstalk 配置数据库,可选 AWS Elastic Beanstalk 设置rds/">Amazon RDS 数据库通过选项值处理,请参阅 常规选项.

      While unfortunately not specifically addressed within Configuring Databases with AWS Elastic Beanstalk, the AWS Elastic Beanstalk settings for an optional Amazon RDS database are handled via Option Values, see namespace aws:rds:dbinstance within General Options.

      虽然 AWS 管理控制台在其 UI 后面隐藏了许多这些选项值,但您可以在使用 API 时明确指定它们通过其他方式,在创建环境以及更新环境时(这是您更改 RDS 数据库实例的任何设置的方式) - 参见例如更新环境<的参数--option-settings/a> 来自 AWS 命令​​行界面:

      While the AWS Management Console hides many of those option values behind its UI, you can specify them explicitly when using the API via other means, both when creating an environment as well as when updating one (which is how you would change any settings of an RDS database instance) - see e.g. parameter --option-settings for update-environment from the the AWS Command Line Interface:

      如果指定,AWS Elastic Beanstalk 会更新与运行环境关联的配置集,并将指定的配置选项设置为请求的值.

      If specified, AWS Elastic Beanstalk updates the configuration set associated with the running environment and sets the specified configuration options to the requested value.

      这篇关于AWS Elastic Beanstalk 更改 RDS 端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆