You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用CloudFormation从现有RDS实例创建Amazon RDS快照?

Alright, let's walk through exactly how to create an Amazon RDS snapshot from an existing RDS instance using CloudFormation. I’ll break this down into simple, actionable steps with examples so you can follow along easily.

1. Know the Right CloudFormation Resource

First off, the CloudFormation resource you’ll use for manual RDS snapshots is AWS::RDS::DBSnapshot. This resource lets you define a snapshot tied directly to an existing RDS instance in your account.

2. Build Your CloudFormation Template

Here’s a sample YAML template you can adapt for your use case. I’ll explain each part so you understand what’s going on:

AWSTemplateFormatVersion: '2010-09-09'
Description: Creates a manual RDS snapshot from an existing production RDS instance
Resources:
  ProductionRDSManualSnapshot:
    Type: AWS::RDS::DBSnapshot
    Properties:
      DBSnapshotIdentifier: prod-rds-snapshot-20240520
      DBInstanceIdentifier: my-production-postgres-instance
      Tags:
        - Key: Environment
          Value: Production
        - Key: BackupType
          Value: Manual

Let’s break down the key properties:

  • DBSnapshotIdentifier: A unique name for your snapshot (stick to letters, numbers, hyphens, underscores, and dots—no leading hyphens). Make sure it doesn’t clash with any existing snapshots in your region.
  • DBInstanceIdentifier: The exact name of your existing RDS instance (this is critical—double-check the instance name in the RDS console to avoid typos). The instance must be in an available state for the snapshot to start.
  • Tags: Optional but highly recommended—add tags to organize your snapshots by environment, purpose, or team.
3. Deploy the Template

You can deploy the template using either the AWS Management Console or the AWS CLI. Let’s cover both methods.

3.1 Using the AWS Console

  1. Open the CloudFormation console and click Create stack → With new resources (standard).
  2. Under "Prepare template", select Template is ready, then choose Upload a template file. Upload your YAML file and click Next.
  3. Give your stack a name (e.g., Create-Prod-RDS-Snapshot) and click Next.
  4. On the "Configure stack options" page, you can leave most settings as default (add additional tags if needed) and click Next.
  5. Review the stack details, check the box acknowledging that CloudFormation might create resources, then click Submit.
  6. Wait for the stack status to change to CREATE_COMPLETE—this usually takes a few minutes depending on your RDS instance size.

3.2 Using the AWS CLI

If you prefer command-line tools, run this command (replace placeholders with your details):

aws cloudformation create-stack \
  --stack-name Create-Prod-RDS-Snapshot \
  --template-body file://path-to-your-template.yaml \
  --region us-east-1

To check the stack status later:

aws cloudformation describe-stacks --stack-name Create-Prod-RDS-Snapshot --region us-east-1
4. Critical Notes & Limitations

Before you dive in, keep these points in mind:

  • Snapshot Impact: For single-AZ RDS instances, you’ll see a brief I/O pause during snapshot creation. Multi-AZ instances avoid this because snapshots are taken from the standby instance.
  • Permissions: The CloudFormation execution role (or your IAM user if deploying manually) needs the rds:CreateDBSnapshot permission, plus access to the target RDS instance.
  • Encryption: If your RDS instance is encrypted, the snapshot will automatically inherit that encryption (using the same KMS key). You can’t encrypt an unencrypted instance’s snapshot after creation.
  • Cross-Region Snapshots: This method creates snapshots in the same region as your instance. To copy a snapshot to another region, you’ll need a separate step (either via the console, CLI, or another CloudFormation resource like AWS::RDS::DBSnapshotCopy).
5. Verify Your Snapshot

Once the stack is complete, confirm the snapshot exists:

  • In the RDS console, go to Snapshots → Manual snapshots and look for your snapshot name. It should show a status of available.
  • Or use the CLI:
aws rds describe-db-snapshots --db-snapshot-identifier prod-rds-snapshot-20240520 --region us-east-1

内容的提问来源于stack exchange,提问作者Tanuj Chinnu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:54:09