By using AWS re:Post, you agree to the Terms of Use
All Questions
Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Lamdba to pull Cloudfront from AWS Config query

Hi, I am trying to use a lamdba to pull from multi accounts and grab CloudFront information, but the following aliases "cname" won't come back ``` selectExpression = "select accountId,resourceId,awsRegion,arn,resourceCreationTime,configurationItemStatus,configuration.domainName,configuration.lastModifiedTime,configuration.distributionConfig.aliases.items,configuration.distributionConfig.origins.items.customOriginConfig.*,configuration.distributionConfig.origins.items.customOriginConfig.httpPort,configuration.distributionConfig.origins.items.customOriginConfig.httpsPort,configuration.distributionConfig.origins.items.customOriginConfig.originSslProtocols,configuration.distributionConfig.origins.items.domainName" selectExpression = selectExpression + " where resourceType = 'AWS::CloudFront::Distribution' print(result['configuration']['distributionConfig']['aliases']['items']) ``` gets an error below but get origin works fine: ``` print(result['configuration']['distributionConfig']['origins']['items']) ``` Any suggestions? also in their docs: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-aliases and works with CLI ``` Error: Response { "errorMessage": "'Aliases'", "errorType": "KeyError", "requestId": "345fga5-a4f4-405b-8c43-319f750e6f1a", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 62, in lambda_handler\n print(result['configuration']['distributionConfig']['Aliases']['items'])\n" ] } ``` ``` { "aliases": { "items": [ "www.foo.com" ] }, "origins": { "items": [ { "domainName": "awseb-e-j-AWSEBLA-1XXXXXXXXXX.us-east-2.elb.amazonaws.com", "customOriginConfig": { "originSslProtocols": { "quantity": 3, "items": [ "TLSv1.2" ] }, "httpPort": 80, "httpsPort": 443 } } ] } } ```
1
answers
0
votes
20
views
asked 17 hours ago
1
answers
0
votes
8
views
asked 18 hours ago
1
answers
0
votes
8
views
asked 19 hours ago