<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Onwubiko Emmanuel - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Onwubiko Emmanuel - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 23 May 2026 19:40:26 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/Datachief007/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Set Up Grafana on EC2 ]]>
                </title>
                <description>
                    <![CDATA[ In today's data-driven world, it's important to monitor and visualize system metrics to make sure everything works consistently and performs well.  Grafana is an open-source analytics and monitoring platform. It has gained widespread recognition amon... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-set-up-grafana-on-ec2/</link>
                <guid isPermaLink="false">66ba0c6be272700c6e2ec43d</guid>
                
                    <category>
                        <![CDATA[ analytics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Grafana ]]>
                    </category>
                
                    <category>
                        <![CDATA[ monitoring ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Onwubiko Emmanuel ]]>
                </dc:creator>
                <pubDate>Fri, 02 Aug 2024 13:42:27 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/08/pexels-kawserhamid-176342.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In today's data-driven world, it's important to monitor and visualize system metrics to make sure everything works consistently and performs well. </p>
<p>Grafana is an open-source analytics and monitoring platform. It has gained widespread recognition among developers and enterprises looking to extract more insights from the data produced by their systems. </p>
<p>Grafana has many powerful visualization features, and when combined with Amazon EC2's scalability and flexibility, it creates a stable environment for efficient monitoring. </p>
<p>This article will walk you through setting up Grafana on Amazon EC2 and creating informative dashboards out of raw data. </p>
<h2 id="heading-for-whom-is-this-intended"><strong>For Whom is this Intended?</strong></h2>
<p>This tutorial is intended for both novices to the cloud and experts in DevOps. The goal of this post is to make the installation process easier so you can use Grafana on AWS to its fullest. Now let's get going.</p>
<h2 id="heading-how-to-configure-your-ec2-instance"><strong>How to Configure Your EC2 Instance</strong></h2>
<p>You need to configure the inbound rule for your EC2 instance to access port 3000, as Grafana operates on this port. But first, you need to establish an EC2 instance. You can follow this guide on how to set up your <a target="_blank" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html">AWS EC2</a> instance. It takes less than 5 minutes.</p>
<p>Once you have created your EC2 instance, you'll need to configure the network inbound rules. So head to your instance page and click on it. On the button widget, click on the <strong>security</strong> tab and click on the security group link (it should look like this: “<strong>sg-547<strong><strong><strong><strong><em>**</em></strong></strong></strong></strong></strong>”). </p>
<p>Once you open the page in the inbound rules section, click on ‘<strong>Edit inbound rules</strong>’. Click on Add a new rule and add <strong>3000</strong> to the port range field, and on the source field, select <strong>0.0.0.0/0.</strong> Then save.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721347239653_image.png" alt="Image" width="1024" height="162" loading="lazy">
<em>Inbound rules</em></p>
<h2 id="heading-how-to-create-an-iam-role"><strong>How to Create an IAM Role</strong></h2>
<p>Now you need to construct an <strong>IAM (Identity Access Management)</strong> role. You're developing an identity role so that you can generate credentials that you'll subsequently use to log in to your Grafana service.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721348061199_IAM+Dashboard.png" alt="Image" width="1912" height="876" loading="lazy">
<em>IAM Dashboard</em></p>
<p>So, in the search field, type "<strong>IAM service</strong>" and click it. Click '<strong>Create role</strong>', and select the AWS service as the trusted entity type.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721348079999_IAM+Role+creation.png" alt="Image" width="1893" height="865" loading="lazy">
<em>IAM Trusted Entity</em></p>
<p>On the use case section, select EC2, then click next.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721348098668_EC2+Use+Case.png" alt="Image" width="1906" height="877" loading="lazy">
<em>IAM role use case</em></p>
<p>On the Add Permissions page, click on the <strong>AdministratorAccess</strong> policy, then click next. Enter a role name – in this case, I used <strong>Grafana-Server-Role.</strong></p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721348120427_IAM+role+modify+.png" alt="Image" width="1916" height="835" loading="lazy">
<em>Role creation</em></p>
<h2 id="heading-how-to-download-grafana">How to Download Grafana</h2>
<p>Now that you've configured your EC2 inbound rule and also configured the IAM role, let's set up Grafana on your EC2 instance. </p>
<p>So head over to <a target="_blank" href="https://grafana.com/grafana/download">Grafana's download page</a>. Since we'll be downloading the version for Amazon Linux in this tutorial, you need to type in the following command on your Linux command line. Note: You need to connect to your VM instance through SSH (Secure Shell). In this case, I am using the EC2 Instance Connect.</p>
<pre><code class="lang-bash">sudo yum install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-11.1.0-1.x86_64.rpm
</code></pre>
<p>Now you'll enable the Grafana service on your terminal by typing the following command:</p>
<pre><code class="lang-bash">systemctl <span class="hljs-built_in">enable</span> grafana-server.service
</code></pre>
<p>Then start the service:</p>
<pre><code class="lang-bash">systemctl start grafana-server.service
</code></pre>
<p>Check the status of the Grafana service on the EC2 instance by running this command:</p>
<pre><code class="lang-bash">systemctl status grafana-server.service
</code></pre>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721411484886_Grafana+Active+.png" alt="Image" width="1101" height="175" loading="lazy">
<em>Grafana Service Status</em></p>
<p>Now that you've confirmed that the service is currently active, you'll also need to check if the Grafana service is active on <strong>port 3000</strong>, as you've already created an inbound rule to cater for this. </p>
<p>You can do this by typing the following command:</p>
<pre><code class="lang-bash">netstat -tunpl | grep grafana
</code></pre>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721411578753_3000+active.png" alt="Image" width="1107" height="22" loading="lazy">
<em>Port 3000 confirmation</em></p>
<p>Now that you've confirmed that the service runs on port 3000, you can go ahead and set up your Grafana dashboard.</p>
<p>You can access the Grafana dashboard by typing the Public IP of your EC2 instance and adding port 3000 on your web browser, something like this: <strong>34.239.101.172:3000</strong>.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721411871355_Grafana.png" alt="Image" width="1877" height="931" loading="lazy">
<em>Grafana Login</em></p>
<p>The default username and password for Grafana are admin, but you'll be given the option to change your password after you sign in with the default credentials. You can also skip the password change process if you like.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721412805910_Grafana+Password.png" alt="Image" width="1902" height="927" loading="lazy">
<em>Change password on Grafana</em></p>
<p>After this step, go to the home page. The next thing to do is to start connecting your Grafana dashboard to a data source. In this case, you're going to connect it to the AWS cloud watch service.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721413426627_Grafana+home.png" alt="Image" width="1918" height="907" loading="lazy">
<em>Grafana</em></p>
<h2 id="heading-how-to-connect-data-sources-to-the-grafana-dashboard"><strong>How to Connect Data Sources to the Grafana Dashboard</strong></h2>
<p>Click on the connections tab on the side menu and click on data sources. Search for the CloudWatch service.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721413905866_image.png" alt="Image" width="1361" height="646" loading="lazy">
<em>Cloudwatch configuration</em></p>
<p>Now you'll be prompted to input your access key ID and secret access key. You will need to create this on your AWS IAM service. </p>
<p>So go back to your IAM management dashboard and go to the user's tab. If you haven’t created an IAM user, you can do so by checking out this <a target="_blank" href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html">IAM user creation tutorial</a>. </p>
<p>In the user IAM dashboard, scroll down to the access keys section and click on <strong>Create access key.</strong></p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721414737862_Access+Key.png" alt="Image" width="1447" height="277" loading="lazy">
<em>Access key</em></p>
<p>Select the Command Line Interface use case.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721414696820_Access+Key+2.png" alt="Image" width="1917" height="876" loading="lazy">
<em>Access key use case</em></p>
<p>Set the description tag. This step is optional. Then click on the <strong>Create access key.</strong></p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721414844084_Access+Key+3.png" alt="Image" width="1787" height="738" loading="lazy">
<em>Access keys</em></p>
<p>Now copy the Access Key ID and Secret access key and paste them into the CloudWatch Datasource configuration page on Grafana. Set your default cloud region – in this case, mine is <strong>us-east-1</strong></p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721414955923_image.png" alt="Image" width="558" height="260" loading="lazy">
<em>Additional settings</em></p>
<p>When you’re done, click on the save and test buttons. Grafana will query the Cloudwatch logs, and if it works fine it will save the configuration.</p>
<h2 id="heading-how-to-create-a-dashboard-on-grafana"><strong>How to Create a Dashboard on Grafana</strong></h2>
<p>Now that you have successfully configured your grafana service, let’s start creating dashboards.</p>
<p>Click on the dashboard tab on the side menu click on <strong>New</strong> and select new dashboard. You should see the screen below:</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721416576260_dashboard.png" alt="Image" width="1910" height="928" loading="lazy">
<em>Create a new dashboard</em></p>
<p>Then select <strong>Import dashboard.</strong></p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721417832804_image.png" alt="Image" width="1354" height="643" loading="lazy">
<em>Import a dashboard</em></p>
<p>For this case, you'll be importing an already-made dashboard from Grafana. Grafana has a lot of dashboards for a lot of use cases and services. But in this case, you'll be importing an EC2 dashboard (<a target="_blank" href="https://grafana.com/grafana/dashboards/11265-amazon-ec2/">Grafana EC2 dashboard</a>). </p>
<p>If you want to import it, you can easily copy the ID of the dashboard that you want to import. It is always accompanied by the dashboard.</p>
<p>So now copy the ID – in this case, it's <strong>11265</strong>. Then paste it into the import field on the import dashboard, and click on the load button.</p>
<p><img src="https://paper-attachments.dropboxusercontent.com/s_4B51535633ABB1D019D79F3934180D191EF4BB549B6DD5EF46643EA16E05EAAE_1721418236847_Grafana+Dashboard.png" alt="Image" width="1912" height="927" loading="lazy">
<em>Grafana Dashboard</em></p>
<p>Now you have successfully created a dashboard in Grafana. This dashboard lets you monitor the performance of your EC2 instance. You can monitor metrics such as CPU Utilization, CPU Credit, Disk Ops, Disk Bytes, Network, Network Packets, Status check, and so on.</p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>Thank you for reading! I hope this step by step guide has helped you learn how to create and set up efficient dashboards using Grafana. </p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
