Created
December 3, 2020 18:31
-
-
Save stewmi/ba1cff952b4b69f069b28d9513fa3392 to your computer and use it in GitHub Desktop.
CloudFormation Error Handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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