<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dario Cabianca</title>
    <description>The latest articles on DEV Community by Dario Cabianca (@dar10).</description>
    <link>https://dev.to/dar10</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4066704%2F0060acf3-719e-495f-a588-8618fe5ff41a.png</url>
      <title>DEV Community: Dario Cabianca</title>
      <link>https://dev.to/dar10</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dar10"/>
    <language>en</language>
    <item>
      <title>How to Automate Dry-Run Restores for EC2 Stacks &amp; Aurora Clusters Using AWS Backup</title>
      <dc:creator>Dario Cabianca</dc:creator>
      <pubDate>Fri, 07 Aug 2026 21:28:29 +0000</pubDate>
      <link>https://dev.to/dar10/how-to-automate-dry-run-restores-for-ec2-stacks-aurora-clusters-using-aws-backup-210b</link>
      <guid>https://dev.to/dar10/how-to-automate-dry-run-restores-for-ec2-stacks-aurora-clusters-using-aws-backup-210b</guid>
      <description>&lt;p&gt;When preparing for the AWS Certified CloudOps Engineer (SOA-C03) exam, data protection isn't just about taking backups—it’s about proving you can restore them seamlessly under pressure in your Disaster Recovery (DR) environment. &lt;/p&gt;

&lt;p&gt;A classic exam scenario and real-world hurdle is automating disaster recovery validation for a multi-tier app: ensuring your stateless app servers and your primary database cluster spin back up in their exact, distinct subnets across multiple Availability Zones (AZs) while retaining their strict security group configurations.&lt;/p&gt;

&lt;p&gt;Instead of navigating the AWS Management Console or writing custom Lambda scripts to test your recovery points, the most minimalist, infrastructure-as-code approach is leveraging the &lt;strong&gt;AWS CLI&lt;/strong&gt; to configure native &lt;strong&gt;AWS Backup Restore Testing Plans&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Here is the operational architecture we are building:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fso6s5paam7ji769wmkfc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fso6s5paam7ji769wmkfc.png" alt=" " width="800" height="1347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is the 3-step operational blueprint to deploy and dry-run this entire application recovery stack strictly from your terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create the Restore Testing Plan via CLI
&lt;/h2&gt;

&lt;p&gt;A Restore Testing Plan automates the evaluation of your backup recovery points. We use the &lt;code&gt;create-restore-testing-plan&lt;/code&gt; CLI command to establish an automated cron schedule (e.g., running weekly) to validate our recovery stack without manual intervention.&lt;/p&gt;

&lt;p&gt;Run the following command to define your testing window, cron pattern, and specify exactly which types of recovery points should be targeted from your vaults:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws backup create-restore-testing-plan &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--region&lt;/span&gt; us-west-2 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-plan&lt;/span&gt; &lt;span class="s1"&gt;'{
        "RestoreTestingPlanName": "MultiTierApp-Restore-Testing-Plan",
        "ScheduleExpression": "cron(0 12 ? * SAT *)",
        "StartWindowHours": 4,
        "Suffix": "dr-test",
        "RecoveryPointSelection": {
            "Algorithm": "LATEST_WITHIN_WINDOW",
            "IncludeVaults": ["*"],
            "RecoveryPointTypes": ["SNAPSHOT"],
            "SelectionWindowDays": 7
        }
    }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Configure Granular Network Overrides per AZ (4 Selections)
&lt;/h2&gt;

&lt;p&gt;Because your architecture involves a Multi-AZ environment—where each of the 3 EC2 instances must be pinned to its own specific Availability Zone (AZ) and subnet, and the Aurora Cluster requires its own Multi-AZ subnet group targeting all 3 AZs to accommodate its 6 distributed storage volumes—a single, flat metadata block will break the deployment. &lt;/p&gt;

&lt;p&gt;We must create &lt;strong&gt;four separate selections&lt;/strong&gt; under the plan to apply unique &lt;code&gt;RestoreMetadataOverrides&lt;/code&gt; for each distinct component. &lt;/p&gt;

&lt;h3&gt;
  
  
  ⚠️ The Importance of the IamRoleArn
&lt;/h3&gt;

&lt;p&gt;When defining these granular resource selections, explicitly providing a valid service role via the &lt;code&gt;"IamRoleArn"&lt;/code&gt; parameter is absolutely critical. AWS Backup cannot use your personal IAM CLI session credentials to execute automated dry-runs in the background. It requires an authoritative, trusted service role that grants the platform explicit, cross-service permissions to interact with EC2, RDS, and your custom network topology to spin up instances and override metadata profiles safely on your behalf.&lt;/p&gt;

&lt;p&gt;Execute these 4 commands to bind your target cloud resources and service roles to the testing plan:&lt;/p&gt;

&lt;h3&gt;
  
  
  Selection A: App Server 1 (AZ1 Mapping)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws backup create-restore-testing-selection &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--region&lt;/span&gt; us-west-2 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-plan-name&lt;/span&gt; &lt;span class="s2"&gt;"MultiTierApp-Restore-Testing-Plan"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-selection&lt;/span&gt; &lt;span class="s1"&gt;'{
        "SelectionName": "EC2-App-Tier-AZ1-Mapping",
        "ProtectedResourceType": "EC2",
        "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/AWSBackupDefaultServiceRole",
        "ProtectedResourceArns": ["arn:aws:ec2:us-west-2:123456789012:instance/i-01111111111111111"],
        "RestoreMetadataOverrides": {
            "SubnetId": "subnet-dr-app-az1",
            "SecurityGroupIds": "[\"sg-dr-app-server\"]",
            "InstanceType": "t3.medium"
        }
    }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Selection B: App Server 2 (AZ2 Mapping)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws backup create-restore-testing-selection &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--region&lt;/span&gt; us-west-2 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-plan-name&lt;/span&gt; &lt;span class="s2"&gt;"MultiTierApp-Restore-Testing-Plan"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-selection&lt;/span&gt; &lt;span class="s1"&gt;'{
        "SelectionName": "EC2-App-Tier-AZ2-Mapping",
        "ProtectedResourceType": "EC2",
        "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/AWSBackupDefaultServiceRole",
        "ProtectedResourceArns": ["arn:aws:ec2:us-west-2:123456789012:instance/i-02222222222222222"],
        "RestoreMetadataOverrides": {
            "SubnetId": "subnet-dr-app-az2",
            "SecurityGroupIds": "[\"sg-dr-app-server\"]",
            "InstanceType": "t3.medium"
        }
    }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Selection C: App Server 3 (AZ3 Mapping)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws backup create-restore-testing-selection &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--region&lt;/span&gt; us-west-2 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-plan-name&lt;/span&gt; &lt;span class="s2"&gt;"MultiTierApp-Restore-Testing-Plan"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-selection&lt;/span&gt; &lt;span class="s1"&gt;'{
        "SelectionName": "EC2-App-Tier-AZ3-Mapping",
        "ProtectedResourceType": "EC2",
        "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/AWSBackupDefaultServiceRole",
        "ProtectedResourceArns": ["arn:aws:ec2:us-west-2:123456789012:instance/i-03333333333333333"],
        "RestoreMetadataOverrides": {
            "SubnetId": "subnet-dr-app-az3",
            "SecurityGroupIds": "[\"sg-dr-app-server\"]",
            "InstanceType": "t3.medium"
        }
    }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Selection D: Aurora Cluster (Multi-AZ DB Subnet Group Mapping)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws backup create-restore-testing-selection &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--region&lt;/span&gt; us-west-2 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-plan-name&lt;/span&gt; &lt;span class="s2"&gt;"MultiTierApp-Restore-Testing-Plan"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--restore-testing-selection&lt;/span&gt; &lt;span class="s1"&gt;'{
        "SelectionName": "RDS-Aurora-Cluster-Mapping",
        "ProtectedResourceType": "RDS",
        "IamRoleArn": "arn:aws:iam::123456789012:role/service-role/AWSBackupDefaultServiceRole",
        "ProtectedResourceArns": ["arn:aws:rds:us-west-2:123456789012:cluster:aurora-app-cluster"],
        "RestoreMetadataOverrides": {
            "DBSubnetGroupName": "subnet-group-dr-aurora",
            "VpcSecurityGroupIds": "[\"sg-dr-aurora-cluster\"]"
        }
    }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Automated Validation &amp;amp; Cleanup
&lt;/h2&gt;

&lt;p&gt;AWS Backup dynamically orchestrates the restore. It automatically instantiates your 3 app instances and the Aurora Cluster into their isolated production-mirror environments, enforces security configurations, and then tears down the temporary infrastructure after a specified retention window (e.g., 1 hour) so you don't incur trailing cloud costs.&lt;/p&gt;




&lt;p&gt;📖 &lt;strong&gt;This troubleshooting workflow is a minimalist excerpt from the new print edition of the &lt;em&gt;AWS Certified CloudOps Engineer (SOA-C03) Study Guide&lt;/em&gt;, available on Amazon:&lt;/strong&gt; &lt;br&gt;
👉 &lt;a href="https://a.co/d/0gyCgRjc" rel="noopener noreferrer"&gt;https://a.co/d/0gyCgRjc&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
