zoukankan      html  css  js  c++  java
  • [AWS] Lab: Install CloudWatch Agent on EC2 instance

    1. Create a Role for CloudWatchAgent

    Create Role for `EC2` Service, attach prolicy

    2. Create an EC2 instance

    • Select the IAM role with the Role you just created
    • add to boostrap
    • #!/bin/bash 
      yum update -y

    3. Connect to EC2 Instance

    1. Bootstrap script: 
    #!/bin/bash
    yum update -y
    
    Install the CloudWatch Agent: 
    sudo yum install amazon-cloudwatch-agent -y
    
    2. Configure the CloudWatch agent: 
    sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
    
    **** Say no to monitoring CollectD ****
    **** Monitor /var/log/messages ****

    3. cd /opt/aws/amazon-cloudwatch-agent/bin
       /opt/aws/amazon-cloudwatch-agent/bin/config.json is the config file
    
    4. Start the CloudWatch Agent
    sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json
    
    5. Generate some activity on our system by installing stress - it’s in the Extra Packages for Enterprise Linux (EPEL) repository, so first we'll install the epel repository, then we'll install stress:
    
    sudo amazon-linux-extras install epel -y
    sudo yum install stress -y
    stress --cpu 1

    You can see the metric it generated:

  • 相关阅读:
    2021.6.2 Python网络编程
    2021.6.1 数据库
    2021.5.29 PHP大作业
    2021.5.28 bootstrap和vue
    2021.5.27 三个和尚
    2021.5.26 Python操作Mysql数据库
    2021.5.25 PHP作业
    2021.5.24 Python解析XML
    如何用 GPU 训练模型?
    44 内核中的中断处理(上)
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14727461.html
Copyright © 2011-2022 走看看