"The specified bucket does not exist" during the Uploading CloudFormation file to S3 portion of codebuild

I got this error in codebuild(see image below). Not sure which S3 bucket it’s referring to. Upon opening the S3 bucket that is created under the stack, it displays Error No Data Found

Please note that this “does not exist” error only occurred in one of our environments. When we tried to deploy or run the codebuild on another environment(different stack), the error did not occur. THe only difference between the different environments are the suffix of each lambda function and stack (e.g. DEV, STAGE). No changes made on the s3 bucket at all.

CloudFormation can have issues when resource created by it are manually deleted. There are generally two strategies for fixing this.

  1. Manually re-create the resource. This only works for some resources and I thought S3 was one of them.

  2. Completely delete the resource from your CloudFormation config, deploy so CloudFormation removes it from the stack, add it back to the config and deploy so CloudFormation creates it again.

If this wasn’t the deployment bucket that would be really easy. You can probably fix it’s going to be complicated (lots of packaging, modifying templates and manual deployments). I don’t suppose you can just delete the stack and create a new one?