在AWS CloudFormation中定义表,视图和索引 [英] Defining Tables, Views, and Indexes in AWS CloudFormation

查看:66
本文介绍了在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆