Skip to content

TechNative-B-V/terraform-aws-module-cloudwatch-agent-setup

Repository files navigation

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.

Prerequisite

How does it work

  1. Run the module to create the roles that are needed for CloudWatch to forward metrics.
  2. Attach either the CloudWatchAgentServerRole or CloudWatchAgentAdminRole to the EC2 instance that needs to forward the metrics.
  3. 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
  4. 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

Usage

To use this module ...

module "cw_agent_setup" {
    source = "../modules/terraform-aws-module-cloudwatch-agent"
}

AWS Documentation

Providers

Name Version
aws n/a

Modules

Name Source Version
cw_admin_role [email protected]:TechNative-B-V/terraform-aws-module-iam-role.git 818f7b89e9b98423fb5517f124c80aa847936e98
instance_role [email protected]:TechNative-B-V/terraform-aws-module-iam-role.git 818f7b89e9b98423fb5517f124c80aa847936e98

Resources

Name Type
aws_iam_instance_profile.cw_agent resource
aws_iam_instance_profile.cw_agent_admin resource
aws_ssm_parameter.cw_config_file resource

Inputs

No inputs.

Outputs

Name Description
cw_config_parameter_name n/a

About

This module contains the configuration to setup cloudwatch-agent using Systems Manager.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages