Skip to content

AWS::EC2::Snapshot fails with "Internal Failure"

0

When I deploy the following CFT, I'm getting this "Internal Failure" error. If I comment out the Snapshot resource, then the stack creates the EBS volume, but with the snapshot resource uncommented, the stack fails before the volume is even created (there's nothing listed in the resources tab).

Enter image description here

Is AWS::EC2::Snapshot no longer supported? I don't see AWS::EC2::Snapshot listed in the CloudFormation Template Reference guide or the schema.json but don't remember if it was ever there.

I'm testing logic to delete snapshots older than x days so way just trying to create a snapshot for testing

AWSTemplateFormatVersion: '2010-09-09'
Description: >
  CloudFormation template to create an EBS volume and a snapshot from it.
Resources:
  EBSSnapshotRetentionVolume:
    Type: AWS::EC2::Volume
    Properties:
      AvailabilityZone: us-east-1a
      Size: 10
      VolumeType: gp3
      Tags:
        - Key: Name
          Value: EBSSnapshotRetentionVolume

  EBSSnapshotRetentionVolumeSnapshot:
    DependsOn: EBSSnapshotRetentionVolume
    Type: AWS::EC2::Snapshot
    Properties:
      VolumeId: !GetAtt EBSSnapshotRetentionVolume.VolumeId
      Description: Snapshot of MyVolume for testing Cost Controls EBS Snapshot Retention
      Tags:
        - Key: Name
          Value: EBSSnapshotRetentionVolumeSnapshot

  test:
    Type: AWS::EC2::Snapshot

Outputs:
  VolumeId:
    Description: The ID of the created EBS volume
    Value: !Ref EBSSnapshotRetentionVolume
  SnapshotId:
    Description: The ID of the created EBS snapshot
    Value: !Ref EBSSnapshotRetentionVolumeSnapshot
1 Answer
1

There are a couple of issues with your CloudFormation template that are causing the "Internal Failure" error:

  1. The resource type AWS::EC2::Snapshot does not exist in CloudFormation. This is why you're not seeing it in the CloudFormation Template Reference guide or schema.json. CloudFormation doesn't have a direct resource type for creating EBS snapshots.

  2. There's also a typo in your template: DependsOn: EBSSnapshotRetentionVolum is missing the final 'e' (should be EBSSnapshotRetentionVolume).

  3. You have an additional test resource that's also trying to use the non-existent AWS::EC2::Snapshot type without any properties.

To create snapshots in CloudFormation, you have a few alternatives:

  1. Use AWS::ImageBuilder::Image if you need to create an AMI
  2. Use a custom resource with Lambda to create snapshots
  3. Use AWS Systems Manager Automation or AWS Backup to manage snapshots

For testing snapshot deletion logic, you might consider creating snapshots manually through the AWS Console or CLI, or using a custom resource in your CloudFormation template that calls the EC2 CreateSnapshot API.

EBS snapshot failures can occur due to various reasons including transient issues, service limits, or permissions problems. If you're implementing snapshot deletion logic, you should also consider handling potential failure scenarios.
Sources
Cloudformation template - unrecognised resource type | AWS re:Post
Automatic Recovery for Failed EBS Snapshot | AWS re:Post
DeleteSnapshotReturnCode - Amazon Elastic Compute Cloud

answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.