Deleting a CloudFront distribution


I am just becoming familiar with AWS and I've used the AWS Toolkit for Visual Studio to deploy a simple Blazor Web Assembly to CloudFront. Now I want to delete the distribution and free up the associated resources. In order to do this I need to disable the distribution. However, when I uncheck Enabled and select "Apply Changes", I get the following error:

"Error saving distribution: WebACLId is missing for the resource"

Being new to AWS, I'm not 100% sure what the WebACLId is (I'm assuming some sort of access control list), or even which resource is missing the WebACLId, or how I go about setting it.

Please help.

3 Answers

In order to delete a CloudFront distribution from AWS console, you first need to check the checkbox next to the desired distribution and then click on DISABLE. Once the distribution is disabled, then you can proceed to DELETE it. Are you following the the steps explained in the following document?

Deleting a distribution

profile pictureAWS
answered a year ago

Yes, you are correct that a WebACLId (Web Access Control List) is a security feature in AWS that is used to control access to resources in CloudFront distributions.

The error message you are seeing "WebACLId is missing for the resource" is indicating that the CloudFront distribution you are trying to disable is currently associated with a WebACLId, and this is required to make changes to the distribution. In order to disable the distribution, you will need to first remove the associated WebACLId.

Here are the steps you can take to remove the WebACLId and disable the distribution:

Go to the AWS Management Console and navigate to the CloudFront service. In the CloudFront Distributions section, select the distribution you want to disable. In the Distribution Settings section, click on the "Edit" button next to "Web ACL". Select "None" from the drop-down menu and click "Yes, Edit". Click on "Save" to save the changes. Now, you should be able to disable the distribution by unchecking the "Enabled" option and clicking "Apply Changes" After disabling the distribution, you can delete it. Be aware that CloudFront will take some time to fully delete the distribution and free up the associated resources.

Keep in mind that removing a WebACLId from a CloudFront distribution will remove all the security rules associated to it, so make sure that the distribution is no longer needed, and that you have an alternative security solution in place before removing the WebACLId

profile picture
answered a year ago

Hi, @Michael.

I understand that you cannot disable CloudFront distribution from AWS Toolkit for Visual Studio after deploying Blazor Web Assembly to CloudFront + S3 using AWS Toolkit for Visual Studio.

I tried the same scenario as you using Visual Studio.

First of all, the AWS Toolkit for Visual Studio's CloudFront distribution management feature probably has a bug.
I think you are getting the error message even though your CloudFront distribution does not have WebACL or AWS WAF applied. (I was the same)
I tried editing several existing distributions, but none of them were able to commit the changes.

And as the other answerer has answered, to disable the CloudFront distribution, you need to disable the distribution from his AWS Management Console, not his AWS Toolkit. I have verified that the distribution can also be removed from the AWS Toolkit for Visual Studio after deactivation from the management console.

However, you may prefer not to remove the distribution directly.

I assume your purpose is to remove the set of resources created by the Blazor Web Assembly deployment.
Resources created by Publish to AWS include various resources other than CloudFront.
So you can find his deployed stack from CloudFormation and by deleting the CloudFormation stack itself you can delete not only the CloudFront distribution but also related resources such as S3, Lambda and IAM.

I have summarized my findings in the following article. please refer.

profile picture
answered a year 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.

Guidelines for Answering Questions