问题
From Aurora Serverless's document, there are 3 ways to create an Aurora serverless DB cluster: AWS management console, CLI, and RDS API. (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/aurora-serverless.create.html)
Form my understanding, one would use EngineMode
in the RDS API to create Aurora Serverless, but this property is not available in AWS::RDS::DBCluster
yet (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html).
Would it be possible to create an Aurora Serverless Cluster from cloudformation? Any advice would be appreciated!
回答1:
Thanks for Chris's update. As an example, here is my cloudFormation template for serverless aurora. We no longer need the 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
More complete example of all available options for RDS (including Aurora): https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html
回答2:
It is now possible to create an AWS::RDS::DBCluster
with an EngineMode
set to serverless
. See more here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-enginemode
回答3:
Simple answer - No. Not till they make it available in CFN. As of 1-2 days ago, the EngineMode
and ScalingConfiguration
property are not yet available in the RDS API, as my API call threw this error. First they will make available the APIs/cli. Once that works, create a CFN Custom Resource
to invoke the RDS API from a lambda. It might be a while before it is made directly available in 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
And I know role/permission is not a problem as I could launch normal Aurora
cluster from the same.
PS: RDS APIs now work for serverless
Edit: Some time in Oct 18, EngineMode
added to CFN, so now this is possible -> https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-enginemode
回答4:
I found an article that indicated that the Go SDK has been updated with the EngineMode parameter, and when I looked through the AWS SDK changelog, I found some RDS updates in the most recent versions. I've had to manually update my AWS CLI to the latest release to get my shell scripts working with that option.
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
No news on the CloudFormation side though.
来源:https://stackoverflow.com/questions/51879688/creating-an-aurora-serverless-cluster-from-cloudformation