{"id":7346,"date":"2023-09-03T22:40:55","date_gmt":"2023-09-03T17:10:55","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=7346"},"modified":"2023-09-03T22:40:59","modified_gmt":"2023-09-03T17:10:59","slug":"how-to-install-cloudwatch-on-instances-run-by-lightsail","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-install-cloudwatch-on-instances-run-by-lightsail\/","title":{"rendered":"How to install CloudWatch on instances run by Lightsail?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\" id=\"c5ea\">Installing CloudWatch on Lightsail instances provides access to a wide array of metrics.Once CloudWatch is configured, a dedicated namespace linked to the Lightsail instance becomes visible on the CloudWatch dashboard<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" id=\"df36\">Follow below steps to install a CloudWatch on a Lightsail instance. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Log in to the Lightsail instance using connect option<br><\/strong><br><strong>2. Download and Install the CloudWatch Agent.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ wget https:\/\/s3.amazonaws.com\/amazoncloudwatch-agent\/debian\/amd64\/latest\/amazon-cloudwatch-agent.deb sudo dpkg -i -E .\/amazon-cloudwatch-agent.deb<br><br>$ sudo dpkg -i -E .\/amazon-cloudwatch-agent.deb<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3. Download and install the collected deamon.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ sudo apt-get update &amp;&amp; sudo apt-get install collectd<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4. Now run the CloudWatch configuration wizard which generates a configuration file.           Once the process is done, the configuration file will be available at \/opt\/aws\/amazon-cloudwatch-agent\/bin\/config.json.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ sudo \/opt\/aws\/amazon-cloudwatch-agent\/bin\/amazon-cloudwatch-agent-config-wizard<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5. Create a new access key from IAM console. Once created, save the credentials.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. Create an AWS Credentials file at \/root\/.aws\/credentials and populate it with your Access ID and Secret Access Key.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">[default]<br>aws_access_key_id=AWS-ACCESS-KEY-ID<br>aws_secret_access_key=AWS-SECRET-ACCESS-KEY<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">7. Update the configuration file at the mentioned location with the path to the credentials created in the previous step.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ sudo vi \/opt\/aws\/amazon-cloudwatch-agent\/etc\/common-config.toml<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">[credentials]<br>shared_credential_file = &#8220;\/home\/bitnami\/.aws\/credentials&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">8. Start the CloudWatchAgent.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ sudo \/opt\/aws\/amazon-cloudwatch-agent\/bin\/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:\/opt\/aws\/amazon-cloudwatch-agent\/bin\/config.json -s<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">9. Check if the agent is running.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ sudo \/opt\/aws\/amazon-cloudwatch-agent\/bin\/amazon-cloudwatch-agent-ctl -m ec2 -a status<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">10. If the process is a success, you should see something like below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-02-113401-3.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"698\" height=\"183\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-02-113401-3.png\" alt=\"\" class=\"wp-image-7351\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-02-113401-3.png 698w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2023\/09\/Screenshot-2023-09-02-113401-3-300x79.png 300w\" sizes=\"(max-width: 698px) 100vw, 698px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">11. Now head to the CloudWatch and click on All Metrics under Metrics.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You should now be able to see the newly created metric for the Lightsail instance.<br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Installing CloudWatch on Lightsail instances provides access to a wide array of metrics.Once CloudWatch is configured, a dedicated namespace linked [&hellip;]<\/p>\n","protected":false},"author":492,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[],"class_list":["post-7346","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1Uu","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/492"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7346"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7346\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}