问题
I'm making a CloudFormation template that creates an opsworks stack, layers and few applications. Within my layers, I have opsworks ones and RDS ones. In the AWS documentation, there is only how to create Opsworks::Layer
but I don't know how to make an Amazon RDS service layer:
{
"Type": "AWS::OpsWorks::Layer",
"Properties": {
"Attributes" : { String:String },
"AutoAssignElasticIps" : Boolean,
"AutoAssignPublicIps" : Boolean,
"CustomInstanceProfileArn" : String,
"CustomJson" : JSON object,
"CustomRecipes" : Recipes,
"CustomSecurityGroupIds" : [ String, ... ],
"EnableAutoHealing" : Boolean,
"InstallUpdatesOnBoot" : Boolean,
"LifecycleEventConfiguration" : LifeCycleEventConfiguration,
"LoadBasedAutoScaling" : LoadBasedAutoScaling,
"Name" : String,
"Packages" : [ String, ... ],
"Shortname" : String,
"StackId" : String,
"Type" : String,
"VolumeConfigurations" : [ VolumeConfiguration, ... ]
}
}
My aim is to automate the creation of my opsworks resources by cloudformation. Any idea how to do this ? Thank you
回答1:
Learning more on cfn-init would be my best bet. Hope this helps you out
回答2:
Unfortunately, according to Richard@AWS as of Dec 9 2015, the RegisterRdsDbInstance API which registers an RDS instance as an OpsWorks service layer is not implemented through an official CloudFormation resource, and there are no scheduled plans to do so.
You can contact AWS to request adding this to their roadmap, but in the meantime here are some alternatives you can try:
- Create your RDS instance and the rest of your OpsWorks stack from a CloudFormation template, then manually attach the RDS service layer to the OpsWorks stack using the AWS Console, AWS CLI, or any another platform's AWS SDK.
- Use a self-managed database instance layer running on an EC2 instance using an AWS::OpsWorks::Layer with a Type of
db-master
, as described in the AWS OpsWorks Template Snippet. - Create a Custom CloudFormation Resource that performs the
RegisterRdsDbInstance
API call, e.g., using a Lambda function and the NodeJS AWS SDK.
来源:https://stackoverflow.com/questions/41359327/create-an-rds-opsworks-layer-by-a-cloudformation-template