amazon-web-services - 是否可以使用 AWS Data Pipeline 将 RDS 数据库转储到 S3?

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

基本上,我想使用 AWS Data Pipeline 将我的 RDS 数据库 pg_dump 到 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?

最佳答案

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

  • 连接到数据库
  • 使用 pg_dump 转储数据库
  • 将其上传到 S3

关于amazon-web-services - 是否可以使用 AWS Data Pipeline 将 RDS 数据库转储到 S3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43990277/

相关文章:

尝试使用模板创建 AWS 堆栈时出现 Python 错误

amazon-web-services - Cloudformation EC2 实例在初始化时将外部 DNS 和 IP 添加到 .conf 文件

amazon-web-services - 错误 : ValidationError - The AWSEBDockerrunVersion key in the Dockerrun. aws.json 文件无效或未包含

java - AWS S3 添加/设置/更新/指定带有预签名 url 的用户元数据

node.js - NodeJs - 用户上传到 s3

amazon-web-services - Amazon Sagemaker Notebook 实例在我注销时停止执行

android - 指定S3 Maven存储库时,Gradle构建因 “host name may not be empty”而失败

amazon-web-services - 部署指定修订版是空文件,但提供的修订版是 zip 文件

amazon-web-services - (AWS) CloudFormation 堆栈与 Amazon Linux 2

amazon-web-services - 访问 cloudfront 分发 s3 被拒绝