Skip to content

Instantly share code, notes, and snippets.

@stewmi
Created December 3, 2020 18:31
Show Gist options
  • Save stewmi/ba1cff952b4b69f069b28d9513fa3392 to your computer and use it in GitHub Desktop.
Save stewmi/ba1cff952b4b69f069b28d9513fa3392 to your computer and use it in GitHub Desktop.
CloudFormation Error Handling
import boto3
import botocore
cfn = boto3.client("cloudformation")
try:
stack_status = cfn.describe_stacks(StackName="test123")
except botocore.exceptions.ClientError as error:
if error.response['Error']['Code'] == "ValidationError":
print("Stack Not Found")
else:
raise error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment