Automate EBS Volume Snapshot

Considerations for Snapshot Lifecycle Policies:

  1. Region-Specific Targeting:
    • Snapshot lifecycle policies work within the same AWS Region as the policy.
  2. Snapshot Creation Timing:
    • The first snapshot starts within an hour of the specified time, followed by subsequent snapshots at their scheduled times.
  3. Multiple Policies for a Volume or Instance:
    • You can use multiple policies for one volume or instance, each with its own schedule.
    • Tags are case-sensitive in targeting resources.
  4. Managing Existing Snapshots:
    • If you remove target tags, existing snapshots are no longer managed, and manual deletion is required.
  5. Policy Impact on New Volumes:
    • If new volumes are attached to a target instance, they are included in the backup during the next policy run.
  6. Custom Cron-Based Schedule:
    • Custom cron-based schedules creating a single snapshot won't auto-delete when the retention threshold is met.
  7. Age-Based Policy Consideration:
    • In age-based policies, if the retention period is shorter than the creation frequency, the last snapshot is retained until the next one is created. Snapshot Archiving Considerations:
  8. Snapshot Archiving Restrictions:
    • Archiving is allowed only for volume-targeting snapshot policies.
    • One archiving rule per schedule is specified.
  9. Archiving Minimum Retention:
    • The minimum retention period in the archive tier is 90 days.
  10. Snapshot Archiving Impact:
    • Archiving converts snapshots to full snapshots, potentially increasing storage costs.
  11. Snapshot Sharing and Archiving:
    • Fast snapshot restore and snapshot sharing are disabled for archived snapshots.
  12. Snapshot Archiving Retry:
    • If archiving fails for 24 hours, the snapshot remains in the standard tier, scheduled for deletion as if it had been archived.
  13. Tagging of Archived Snapshots:
    • Archived snapshots are tagged for identification.
  14. Excluding Root Volumes and Data Volumes:
    • Excluding root volumes impacts snapshot creation for the entire instance.
  15. Deleting Volumes or Terminating Instances:
    • Deleting volumes or terminating instances affects snapshots based on the retention schedule.
  16. Fast Snapshot Restore:
    • Enabled only for snapshots 16 TiB or less, and charges apply per minute.
  17. Multi-Attach Enabled Volumes:
    • When targeting instances with Multi-Attach enabled volumes, separate snapshots are initiated for each attached instance.
  18. Snapshot Sharing Across Accounts:
    • Encrypted snapshots require sharing the KMS key; default encryption KMS key snapshots can't be shared.
  19. Snapshot Archiving and Recycle Bin:
    • Manually archived snapshots in the Recycle Bin must be managed manually.
  20. Policies in Error State:
    • Policies in error state affect snapshot retention; manual deletion may be required.
  21. Snapshot Lock Considerations:
    • Manually locked snapshots need manual deletion if still locked when their retention threshold is reached.

These considerations provide insights into managing snapshots effectively using lifecycle policies in AWS. Sure, here are simplified steps to create a snapshot policy in Amazon EC2:

  1. Go to the Amazon EC2 website: https://console.aws.amazon.com/ec2/.
  2. In the menu, select Elastic Block Store, then Lifecycle Manager, and click on Create lifecycle policy.
  3. Choose EBS snapshot policy and click Next.
  4. Specify the type of resource to back up (Volume or Instance) in the Target resources section.
  5. If using AWS Outpost, choose the location of the target resources.
  6. Choose the resource tags to identify volumes or instances for backup.
  7. Enter a brief description for the policy.
  8. Choose the IAM role that has permissions for managing snapshots.
  9. Add tags for identification and categorization.
  10. Choose to enable or disable the policy for immediate or manual start.
  11. If targeting instances, decide whether to exclude volumes from multi-volume snapshot sets.
  12. Configure the policy schedules, including name, frequency, start time, and retention type.
  13. Specify the snapshot destination, tagging, and pre/post scripts if needed.
  14. For volume-targeting policies, configure snapshot archiving.
  15. Enable fast snapshot restore if desired, and choose the Availability Zones.
  16. Configure cross-Region copy if needed.
  17. Configure cross-account sharing if required.
  18. Add additional schedules if necessary.
  19. Review the policy summary.
  20. Finally, choose to create the policy.

https://www.youtube.com/watch?v=s3gMJU9Nc7U&list=PL6XT0grm_TfgtwtwUit305qS-HhDvb4du&index=32