从 cloudformation 创建 Aurora Serverless 集群?

Creating an Aurora Serverless Cluster from cloudformation?

根据 Aurora Serverless 的文档,有 3 种方法可以创建 Aurora serverless 数据库集群:AWS 管理控制台、CLI 和 RDS API。 (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/aurora-serverless.create.html)

根据我的理解,人们会在 RDS API 中使用 EngineMode 来创建 Aurora Serverless,但是这个 属性 在 AWS::RDS::DBCluster 中还不可用(https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html).

是否可以从 cloudformation 创建 Aurora Serverless 集群?如有任何建议,我们将不胜感激!

简单的答案 - 不。直到他们在 CFN 中提供它。截至 1-2 天前,EngineModeScalingConfiguration 属性 在 RDS API 中尚不可用,因为我的 API 调用抛出了此错误。首先,他们将提供 APIs/cli。一旦成功,创建一个 CFN Custom Resource 以从 lambda 调用 RDS API。它可能需要一段时间才能直接在 CFN 中提供。

2018-08-15T16:12:09.648Z f57erb2b-g3a5-11e8-8f64-81912181e535 { MultipleValidationErrors: There were 2 validation errors: * UnexpectedParameter: Unexpected key 'EngineMode' found in params * UnexpectedParameter: Unexpected key 'ScalingConfiguration' found in params

而且我知道 role/permission 不是问题,因为我可以从相同的位置启动正常的 Aurora 集群。

PS:RDS APIs 现在适用于无服务器

编辑:10 月 18 日的某个时候,EngineMode 添加到 CFN,所以现在这是可能的 -> https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-enginemode

我发现一篇文章指出 Go SDK 已使用 EngineMode 参数更新,当我查看 AWS SDK 更新日志时,我发现最新版本中有一些 RDS 更新。我必须手动将我的 AWS CLI 更新到最新版本才能让我的 shell 脚本使用该选项。

https://github.com/aws/aws-cli/releases

https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst

https://github.com/terraform-providers/terraform-provider-aws/issues/5503

不过 CloudFormation 方面没有任何消息。

现在可以创建 AWS::RDS::DBCluster 并将 EngineMode 设置为 serverless。在此处查看更多信息:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-enginemode

感谢克里斯的更新。例如,这是我的无服务器极光 cloudFormation 模板。我们不再需要 DBInstance.

  RDSCluster:
    Type: AWS::RDS::DBCluster
    Properties:
      MasterUsername: 
        Ref: DBUsername
      MasterUserPassword: 
        Ref: DBPassword
      DatabaseName: RANDOMNAME
      Engine: aurora
      EngineMode: serverless
      ScalingConfiguration:
        AutoPause: true
        MaxCapacity: 16
        MinCapacity: 2
        SecondsUntilAutoPause: 300
      DBSubnetGroupName:
        Ref: DBSubnetGroup

RDS(包括 Aurora)所有可用选项的更完整示例: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html

对于 Aurora Postgres Serverless,我完整的工作 DBCluster 资源是:

  RDSCluster:
    Type: AWS::RDS::DBCluster
    Properties:
      DBClusterIdentifier: !Ref DBClusterName
      MasterUsername: some-name
      MasterUserPassword: some-password
      DatabaseName: some-db-name
      Engine: aurora-postgresql
      EngineMode: serverless
      EngineVersion: '10' # this currently provisions '10.serverless_14'
      EnableHttpEndpoint: true # for HTTP API endpoint
      ScalingConfiguration:
        AutoPause: true
        MaxCapacity: 2
        MinCapacity: 2 # min 2 currently
        SecondsUntilAutoPause: 900 # 15 min
      DBSubnetGroupName:
        Ref: DBSubnetGroup