Collect Metrics and Logs from Amazon EC2 instances with the CloudWatch Agent

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Applause] [Music] in this video you'll see how to easily configure and deploy the cloud watch agent to collect metrics and logs from your Amazon Elastic Compute cloud instances and provide measurable and actionable data about system performance we'll start in the AWS management console before you can install the cloud watch agent on your windows and linux servers you'll need to first ensure that your instances are being managed by AWS Systems Manager to do this let's create a role having specific permissions in Identity and Access Management the service that will use this role is Amazon Elastic Compute cloud or ec2 next let's search for the appropriate policy to attach to the role in this case we want to give systems manager permission to manage our ec2 instances next let's search for the policies that will allow the cloud watch agent to save an agent configuration file - Systems Manager parameter store and to write data to cloud watch next and a rural name when you're ready click the button to create the roll once you've created a role that ensures your instances will be managed by Systems Manager you can assign the role to existing instances or create new instances in this case let's create a new ec2 instance the cloud watch agent be installed on either Windows or Linux instances and the process is very similar in this case we'll create a Windows instance next choose an instance type and then configure the instance details sign the roll we just created to this instance ensure that you have selected the appropriate key pair you want to use to connect to this instance and then accept the terms now we can launch the instant next let's name the instant now that we've created a new instance let's connect to it with a remote desktop session and install the cloud watch agent to connect to the instance will first need to retrieve the password paste the contents of your private key file into the field now copy the password we're now ready to connect to the instance with remote desktop download the remote desktop file and then use the RDP shortcut file to connect to the instance with the password we retrieved this is the windows instance we just created let's navigate to the location where the cloud watch agent will be installed Amazon includes some utilities and drivers on new instances but the cloud watch agent has not yet installed to install the agent navigate to systems manager manage two instances select the instance we just created now let's use run command to install the agent on that instant select the configure a WS package command note that this same command could also be used to install the agent on a Linux instance type the name of the package to install in this case we want to install the cloud watch agent select the target instance down and click run once the command is finished executing refresh the page to view the result as you can see the agent has successfully installed let's return to the remote desktop window the folder for the agent is now present on the instance let's open it run command installed a configuration wizard you can use to create a config file for the agent settings this file can be stored in the Systems Manager parameter store and used to configure as many servers as needed with the same cloud watch agent settings let's see how to use this configuration wizard from command prompt navigate to the folder with the cloud watch agent files first navigate to the Amazon CloudWatch agent program files next display the cloud watch agent directory now run the configuration wizard in this case we'll accept the default choice to run the agent on Windows can be run on ec2 instances or on-premises will choose ec2 let's proceed through the configuration wizard and accept the default values default here monitors host metrics and reports them to cloud watch host metrics can include important data on CPU and memory utilization here let's choose to collect standard metrics if you want you can review the metrics configuration and make changes once you're satisfied with your choices accept the default choice to continue next you have the option to monitor any additional customized log files on the instance let's review how to collect these customized logs for the purposes of illustration the Internet Information Services or iis web server has been installed on this instant let's view the log files that I is generates when the website is visited you this is an example of a custom log file that can also be transmitted the cloud watch by the agent we'll enter a path to that log file here let's provide a custom log group name that will show up in cloud watch also choose to monitor windows event logs the default to monitor the system log will also provide a log group name for the windows event logs once you've completed the configuration you have the option to store the config file in the Systems Manager parameter store this allows you to apply the same cloud watch agent settings on as many instances as you need let's choose that option we'll accept the default parameter store name the configuration has been successfully uploaded to the parameter store and the configuration agent is now finished once you no longer need to transmit figuration files to the parameter store it's a best practice to remove that policy from the role as you can see this policy has permission to both get and put configuration files to the parameter store let's go ahead and detach it you can always attach the policy again later if you need it next let's navigate to the AWS Systems Manager parameter store to view the cloud watch agent settings we configured here you can see the config file we just setup using the configuration wizard scroll down to review the settings and ensure the configuration is correct now let's navigate to our managed instances and see how to apply the configuration so we can start collecting data in cloud watch we'll apply the configuration to our windows instance now let's search for the Amazon CloudWatch managed agent command next type the name of the configuration file we created in the parameter store next scroll down and select the target instance you want to apply the configuration to now scroll down and run the command refresh the page to see the result select the instance and review the output as you can see the windows instance configured successfully now let's navigate the cloud watch and review the data we've collected Amazon CloudWatch monitors your AWS resources and the applications you run on AWS you can use cloud watch to collect and track metrics measurable data about the performance of your systems here you can see all the metrics being captured by the cloud watch agent this includes metrics on the processor memory disks and more also reviewed data from the logs here are the two log groups we set up with the configuration wizard for Windows system events and for iis each iis server has its own individual log stream cloud watch logs insights enables you to interactively search and analyze your log data in Amazon Cloud watch logs if an issue occurs you can use queries to quickly identify potential causes and validate deployed fixes if you want you can visualize your log data to gain quicker insights you've just seen how to easily configure and deploy the cloud watch agent to collect metrics and logs from your ec2 instances and provide measurable and actionable data about system performance thanks for watching now it's your turn to try
Info
Channel: Amazon Web Services
Views: 56,827
Rating: 4.782258 out of 5
Keywords: AWS, Amazon Web Services, Cloud, cloud computing, AWS Cloud, CloudWatch Agent, Logs, Metrics, Run Command
Id: vAnIhIwE5hY
Channel Id: undefined
Length: 11min 11sec (671 seconds)
Published: Fri Jul 05 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.