I'm trying to retrieve the status of my Cloudfront distributions through boto3 but it seems like the status returned through get_distribution or list_distributions only returns the state instead (Deployed or in-progress).
{ "ResponseMetadata":{ "RequestId":"bacc7917-90b4-4f91-8915-5dc7201b179a", "HTTPStatusCode":200, "HTTPHeaders":{ "x-amzn-requestid":"bacc7917-90b4-4f91-8915-5dc7201b179a", "etag":"ECIVXNE16EKWC", "content-type":"text/xml", "content-length":"3102", "date":"Thu 02 Feb 2023 21:33:47 GMT" }, "RetryAttempts":0 }, "ETag":"ECIVXNE16EKWC", "Distribution":{ "Id":"E2H2PR2OHJ17TC", "ARN":"arn:aws:cloudfront::556730911179:distribution/E2H2PR2OHJ17TC", "Status":"Deployed", "LastModifiedTime":"datetime.datetime(2023, 2, 2, 21, 29, 35, 959000, tzinfo=tzutc())", "InProgressInvalidationBatches":0, "DomainName":"dx4o38vn878h1.cloudfront.net", "ActiveTrustedSigners":{ "Enabled":false, "Quantity":0
Anyone know a way to return the status (enabled / disabled) of a cloudfront distribution through boto3 ?
I tried returning the output through get_distribution and list_distributions
CodePudding user response:
Documentation & API for config mentions 'Enabled' field but also says it is to enable/disable the distribution. Might worth to try inspecting get_distribution_config
to see if Enabled is coming back in the results.