{"id":1727,"date":"2024-03-19T09:28:19","date_gmt":"2024-03-19T09:28:19","guid":{"rendered":"https:\/\/shreyapohekar.com\/blogs\/?p=1727"},"modified":"2024-03-19T09:28:23","modified_gmt":"2024-03-19T09:28:23","slug":"setting-up-elasticsearch-and-kibana-on-ec2-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/shreyapohekar.com\/blogs\/setting-up-elasticsearch-and-kibana-on-ec2-a-step-by-step-guide\/","title":{"rendered":"Setting Up Elasticsearch and Kibana on EC2: A Step-by-Step Guide"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p><strong>Introduction:<\/strong><br>In the world of data analytics and log management, Elasticsearch and Kibana stand out as powerful tools for indexing, searching, and visualizing large volumes of data. In this tutorial, we&#8217;ll walk through the process of setting up Elasticsearch and Kibana on an EC2 instance, enabling you to harness the full potential of these tools for your projects.<\/p>\n\n\n\n<p><strong>Prerequisites:<\/strong><br>Before we dive into the installation and setup process, ensure you have the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An AWS account with access to EC2 services.<\/li>\n\n\n\n<li>Basic knowledge of working with Linux terminal commands.<\/li>\n\n\n\n<li>Access to an EC2 instance running a Linux distribution( ubuntu preferred ).<\/li>\n<\/ul>\n\n\n\n<p><strong>Installation Steps:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Update Package Repository:<\/strong> <code>sudo apt-get update<\/code><\/li>\n\n\n\n<li><strong>Install Java Development Kit (JDK) 11:<\/strong> <code>sudo apt-get install -y openjdk-11-jdk<\/code><\/li>\n\n\n\n<li><strong>Install Elasticsearch:<\/strong> <br><code>wget -qO - https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add -<\/code><br><code> sudo sh -c 'echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" > \/etc\/apt\/sources.list.d\/elastic-7.x.list' <\/code><br><code>sudo apt-get update <\/code><br><code>sudo apt-get install -y elasticsearch <\/code><br><code>sudo systemctl start elasticsearch <\/code><br><code>sudo systemctl enable elasticsearch<\/code><\/li>\n\n\n\n<li><strong>Install Kibana:<\/strong> <br><code>sudo apt-get install -y kibana <\/code><br><code>sudo systemctl start kibana <\/code><br><code>sudo systemctl enable kibana<\/code><\/li>\n\n\n\n<li><strong>Configure Kibana:<\/strong><br>Open <code>\/etc\/kibana\/kibana.yml<\/code> and uncomment or add the following lines: <br><code>server.host: \"0.0.0.0\" <\/code><br><code>server.port: 5601<\/code> <br><code>elasticsearch.username: \"kibana_system\"<\/code><br><code>elasticsearch.password: \"password\"<\/code><br><\/li>\n\n\n\n<li><strong>Restart Kibana Service:<\/strong> <br><code>sudo systemctl restart kibana<\/code><\/li>\n\n\n\n<li><strong>Verify Connectivity:<\/strong><br>Ensure you can connect to Kibana by using Telnet: <br><code>telnet &lt;EC2_IP> 5601<\/code><\/li>\n\n\n\n<li><strong>Setup Passwords:<\/strong><br>Run the following command to initiate password setup for Elasticsearch users: <br><code>cd \/usr\/share\/elasticsearch sudo .\/bin\/elasticsearch-setup-passwords auto<\/code> Follow the prompts to generate and set passwords for various users. The password will also be generated for <code>kibana_system<\/code> user. Replace this in the config file in step 5.<\/li>\n\n\n\n<li><strong>Enable Security in Elasticsearch:<\/strong><br>Add the following line to <code>\/etc\/elasticsearch\/elasticsearch.yml<\/code> to enable security: <code>xpack.security.enabled: true<\/code><br><br>This step is required to add the login screen. Otherwise, the dashboard would load up without asking for any credentials.<br><\/li>\n\n\n\n<li><strong>Restart Elasticsearch Service:<\/strong><br>After making configuration changes, restart Elasticsearch and Kibana:<br><code>sudo systemctl restart elasticsearch<\/code><br><code>sudo systemctl restart kibana<\/code><\/li>\n\n\n\n<li>Additionally dont forget to expose the port 5601 via the inbound rules of security group in aws. Now you can visit <code>IP:5601<\/code> and the kibana should load.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Logs<\/h3>\n\n\n\n<p>In case you run into any errors, you can view the Kibana logs at <code>\/var\/log\/kibana\/kibana.log<\/code><\/p>\n\n\n\n<p><strong>Conclusion:<\/strong><br>Congratulations! You&#8217;ve successfully set up Elasticsearch and Kibana on your EC2 instance. These powerful tools are now ready to help you manage, analyze, and visualize your data effectively. Explore further customization options and integrations to make the most out of your Elasticsearch and Kibana setup. Happy analyzing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction:In the world of data analytics and log management, Elasticsearch and Kibana stand out as powerful tools for indexing, searching, and visualizing large volumes of data. In this tutorial, we&#8217;ll walk through the process of setting up Elasticsearch and Kibana on an EC2 instance, enabling you to harness the full potential of these tools for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[1],"tags":[435,433,431,432,71,434],"class_list":["post-1727","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-analytics","tag-ec2","tag-elasticsearch","tag-kibana","tag-linux","tag-setup","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/1727"}],"collection":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/comments?post=1727"}],"version-history":[{"count":6,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/1727\/revisions"}],"predecessor-version":[{"id":1733,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/1727\/revisions\/1733"}],"wp:attachment":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/media?parent=1727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/categories?post=1727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/tags?post=1727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}