从CloudFormation启用Aurora Data Api

时间:2019-02-28 17:54:34

标签: amazon-web-services amazon-cloudformation amazon-rds-aurora aws-aurora

我有一个CloudFormation模板,它使用aurora serverless创建我的RDS集群。我希望在启用数据API的情况下创建集群。

该选项存在于Web控制台上: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html

但是我无法在CloudFormation文档中找到它。 如何从模板上启用此选项?

3 个答案:

答案 0 :(得分:2)

当前只能在Web控制台中启用Data API。该功能仍处于测试阶段,因此诸如CloudFormation支持和us-east-1以外的可用性之类的事项仍在等待中,在生产中使用Data API时应谨慎,因为它可能仍会更改。

答案 1 :(得分:2)

the EnableHttpEndpoint property设置为10 20 30 40 50 60 70 80 90 100 200 300 400 ,例如:

true

答案 2 :(得分:1)

您可以通过创建自定义资源支持的lambda来启用CloudFormation的Data API,并使用任何可用的SDK启用它。

我使用boto3(python),因此lambda的代码如下:

import boto3

client = boto3.client('rds')

response = client.modify_db_cluster(
    DBClusterIdentifier='string',
    EnableHttpEndpoint=True|False
) 

显然,您需要处理不同的自定义资源请求类型,并以成功或失败从lambda返回。但是要回答您的问题,这是通过CloudFormation设置数据API的最佳方法,目前,恕我直言。

有关此功能(Boto3)的更多信息: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds.html#RDS.Client.modify_db_cluster