在AWS CloudFormation中定义表,视图和索引 [英] Defining Tables, Views, and Indexes in AWS CloudFormation
问题描述
在AWS CloudFormation中,您可以使用JSON / YAML模板定义服务堆栈。特别是,我正在使用 Redshift 和 Aurora 集群。 / p>
该模板允许您定义集群的管理属性,但是似乎没有明确的方法来定义集群中的表,视图和索引,从而当我推送堆栈更新时,数据库会根据需要自动更新架构,类似于它管理对完整堆栈的更新的方式。
是否有一种管理架构的方法形成云中的Redshift和Aurora数据库?
在Progess中工作!
因此,抓取文档,Github和与AWS聊天一个小时后,我可能需要o创建父级和子级堆栈( 示例模板)。父堆栈包含一个 SNS主题, SNS订阅和 Lambda函数来监视孩子
父堆栈可能看起来像
AWSTemplateFormatVersion: '2010-09-09'
资源:
StackEventTopic:
类型:AWS :: SNS :: Topic
StackEventEmailSubscription:
类型:AWS: :SNS :: Subscription
属性:
协议:email
端点:<您的电子邮件> @ gmail.com
TopicArn:
参考:StackEventTopic
StackEventLambda订阅:
类型:AWS :: S NS :: Subscription
属性:
协议:lambda
端点:$ b $ b参考:StackEventHandler
TopicArn:
参考:StackEventTopic
StackEventHandler:
类型:AWS :: Lambda :: Function
属性:
...配置您的Lambda ...
ChildStack:
类型:AWS :: CloudFormation :: Stack
属性:
NotificationARNs:
参考:StackEventTopic
TemplateURL:模板YAML的s3网址
In AWS CloudFormation, you can define a stack of services with a JSON/YAML template. In particular, I am using Redshift and Aurora clusters.
The template allows you to define administrative properties of the cluster, but there doesn't seem to be a clear way to define tables, views, and indexes in the cluster such that when I push updates of stack, the DB's automatically update the schema as needed, similar to the way it manages updates to full stacks.
Is there a way to manage the schema of Redshift and Aurora databases in Cloud Formation?
Work in Progess!! I'll update once I am sure that it is working!
So crawling documentation, Github and an hour on chat with AWS yields that I might need to create a parent and child stack (example templates). The parent stack would contain a SNS Topic, SNS Subscription and Lambda Function that monitor the child stack.
A parent stack might look like,
AWSTemplateFormatVersion: '2010-09-09'
Resources:
StackEventTopic:
Type: AWS::SNS::Topic
StackEventEmailSubscription:
Type: AWS::SNS::Subscription
Properties:
Protocol: email
Endpoint: <your email>@gmail.com
TopicArn:
Ref: StackEventTopic
StackEventLambdaSubscription:
Type: AWS::SNS::Subscription
Properties:
Protocol: lambda
Endpoint:
Ref: StackEventHandler
TopicArn:
Ref: StackEventTopic
StackEventHandler:
Type: AWS::Lambda::Function
Properties:
... configure your Lambda ...
ChildStack:
Type: AWS::CloudFormation::Stack
Properties:
NotificationARNs:
Ref: StackEventTopic
TemplateURL: "s3 url for template YAML"
这篇关于在AWS CloudFormation中定义表,视图和索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!