Terraform-provider-aws: Amazon CloudFront additional real-time metrics in Amazon CloudWatch

Created on 13 Jan 2020  路  6Comments  路  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

AWS recently released feature in CloudFront to view additional cloudwatch metrics.

New or Affected Resource(s)

aws_cloudfront_distribution

Potential Terraform Configuration

terraform "aws_cloudfront_distribution" "cf_name" {
   ....
   additional_metrics = true
   ....
}

References

https://aws.amazon.com/about-aws/whats-new/2019/12/cloudfront-realtime-metrics/
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/viewing-cloudfront-metrics.html#monitoring-console.distributions-additional

enhancement needs-triage

Most helpful comment

Apparently the console is using an undocumented API method (UpdateMonitoringSubscription) that is not public yet and not part of any SDK I checked. AWS support confirmed to me that it is not possible yet through SDK.
image

All 6 comments

Hi, any update on this ? This feature will be greatly appreciated !

I was looking for this as well, but wasn't able to find the functionality implemented in https://github.com/aws/aws-sdk-go. Did I miss it? If not, it's doubtful this can move forward until the SDK supports it.

Apparently the console is using an undocumented API method (UpdateMonitoringSubscription) that is not public yet and not part of any SDK I checked. AWS support confirmed to me that it is not possible yet through SDK.
image

@piyushsonigra Is there a way to enable real time metrics via terraform now ?

The functionality to manage additional and real-time metrics is already available in the aws-sdk-go since v1.34.13:

You can now manage CloudFront's additional, real-time metrics with the CloudFront API.

@anmolbhatia05 directly inside terraform resource, it's not available yet but you can enable additional metrics using null_resource and local-exec Provisioner and execute AWS cli command.

resource "aws_cloudfront_distribution" "distribution" {
  ....
  ....
}

resource "null_resource" "cloudfront_addtional_metrics" {

 provisioner "local-exec" {
   command = "aws --profile $aws_profile cloudfront create-monitoring-subscription --distribution-id $cloudfront_distribution_id --monitoring-subscription RealtimeMetricsSubscriptionConfig={RealtimeMetricsSubscriptionStatus=Enabled}"

   environment = {
      aws_profile = var.aws_profile
      cloudfront_distribution_id = aws_cloudfront_distribution.distribution.id
    }
  }
}

Was this page helpful?
0 / 5 - 0 ratings