This module contains the configuration to setup cloudwatch-agent using Systems Manager.
HCLApache-2.0
Terraform AWS cloudwatch agent setup
This module implements the needed roles and SSM parameter configuration for setting up CloudWatch agent via the SSM service. The setup only works with instances running in AWS.
Run the module to create the roles that are needed for CloudWatch to forward metrics.
Attach either the CloudWatchAgentServerRole or CloudWatchAgentAdminRole to the EC2 instance that needs to forward the metrics.
Use SSM run command and choose in the command document list the AWS-ConfigureAWSPackage to install CWagent if not already installed.
a. In the name box fill in AmazonCloudWatchAgent
Use SSM run command and choose in the command document list the AmazonCloudWatchAgent to configure your CloudWatch Agent.
a. In the Action list, choose configure.
b. In the Optional Configuration Source list, choose ssm.
c. In the Optional Configuration Location box, enter the name of the agent configuration file that you created and saved to Systems Manager Parameter Store.
d. In the Optional Restart list, choose yes to start the agent