【问题标题】:Is it possible to dump a RDS database to S3 using AWS Data Pipeline?是否可以使用 AWS Data Pipeline 将 RDS 数据库转储到 S3?
【发布时间】:2017-08-30 14:09:36
【问题描述】:

基本上我想使用 AWS Data Pipeline pg_dump 我的 RDS 数据库到 S3,

我不是 100% 确定这是否可能我已经到了 SqlDataNode 想要 selectQuery 的阶段,此时我想知道该怎么做。

以下是我目前的模板:

AWSTemplateFormatVersion: "2010-05-15"

Description: RDS to S3 Dump

Parameters:
  RDSInstanceID:
    Description: "Instance ID of RDS to Dump from"
  DatabaseName:
    Description: "Name of the Database to Dump"
    Type: String
  Username:
    Description: "Database Username"
    Type: String
  Password:
    Description: "Database password"
    Type: String
    NoEcho: true

RDSToS3Dump:
  Type: "AWS::DataPipeline::Pipeline"
  Properties:
    Name: "RDSToS3Dump"
    Description: "Pipeline to backup RDS data to S3"
    Activate: true
    ParameterObjects:
      -
        name: "SourceRDSTable"
        type: "SqlDataNode"
        Database: !Ref DatabaseName
      -
        name: !Ref DatabaseName
        type: "RdsDatabase"
        databaseName: !Ref DatabaseName
        username: !Ref Username
        password: !Ref Password
        rdsInstanceId: !Ref RDSInstanceID
      -
        name: "S3OutputLocation"
        type: "S3DataNode"
        filePath: #TODO: S3 Bucket here parameterized? Will actually need to create one.
      -
        name: "RDStoS3CopyActivity"
        type: "CopyActivity"
        input: "SourceRDSTable"
        output: "S3OutputLocation"
        #TODO: do we need a runsOn?

【问题讨论】:

    标签: amazon-web-services amazon-s3 amazon-cloudformation rds amazon-data-pipeline


    【解决方案1】:

    正如另一个答案中提到的,AWS Data Pipeline 只允许您转储表而不是整个数据库。如果您真的想使用pg_dump 使用AWS CloudFormation 将数据库的全部内容转储到 S3,您可以 使用Lambda-backed custom resources。沿着这条路线走,您必须编写一个 Lambda 函数:

    • 连接到数据库
    • 使用pg_dump 获取数据库的转储
    • 上传到 S3

    【讨论】:

      【解决方案2】:

      使用数据管道我相信您只能转储表而不是像 pg_dump 那样转储整个数据库。

      您是否查看过文档,因为 selectQuery 只需要一条 SQL 语句来处理您要转储的内容,即“select * from mytable”?也许这有帮助。 http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-object-sqldatanode.html

        -
          name: "SourceRDSTable"
          type: "SqlDataNode"
          Database: !Ref DatabaseName
          table: "mytable"
          selectQuery: "select * from #{table}"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-09-01
        • 1970-01-01
        • 2019-04-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-08-26
        相关资源
        最近更新 更多