Score:0

Using cloudwatch agent without secret and key in AWS

ua flag

Our current instances use this deprecated method of collecting metrics https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-scripts-intro.html

It's basically a cron job that runs a command to send data to cloudwatch

mon-put-instance-data.pl --mem-used --mem-util --disk-space-util --disk-path=/ --from-cron

It uses credentials from awscreds.conf the contents of which have this format

AWSAccessKeyId=ABCD
AWSSecretKey=SDSDFSDF

We want to move to using cloudwatch agent for 2 reasons

  1. The agent has better capabilities in terms of data collection
  2. Since keys have to be rotated every 90 days it's cumbersome to replace the key and secret in awscreds.conf every 90 days.

While going through the doc for installing and configuring the cloudwatch agent I came across https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-cloudwatch-agent-configuration-file-wizard.html which mentions putting the secret and key in aws config file.

My question is, if I'm already attaching an IAM role to the EC2 as described in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-iam-roles-for-cloudwatch-agent-commandline.html why do I need to add secret and key for authentication?

Is there a way for sending metrics without using secret and key?

Kohini avatar
ua flag
Apparently the access key and secret is not required. It was only required in my case since I had chosen the option to push config file generated by cloudwatch agent installer to SSM, which requires authentication. Otherwise strictly for sending metrics the IAM role suffices
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.