Which action will deliver the custom metrics to CloudWatch?
Ensure that the CloudWatch agent JSON configuration file has an IAM policy that has the CloudWatch:PutMetricLogs permission attached.
Ensure that the role used in the EC2 Auto Scaling launch template has the CloudWatchAgentServerPolicy IAM policy attached.
Attach the CloudWatchAgentServerPolicy IAM policy directly to the EC2 Auto Scaling launch template in the AWS Management Console.
Attach a JSON script with the CloudWatch:PutMetricLogs permission to the EC2 Auto Scaling launch template in the AVVS Management Console.
Explanations:
The CloudWatchpermission is for log delivery, not for custom metrics. The correct permission needed is CloudWatch.
The CloudWatchAgentServerPolicy IAM policy grants the necessary permissions to the EC2 instances to publish custom metrics to CloudWatch.
The IAM policy should be attached to the EC2 instance role, not directly to the Auto Scaling launch template.
JSON scripts with permissions are not a valid way to attach permissions in an Auto Scaling launch template. Permissions must be granted through IAM policies.