Static and Dynamic and IP addresses: Assigning a static ip address to an AWS EC2 instance

S

Stephane Mensah

Guest
Got it โœ… Letโ€™s turn your EC2 IP experience into a Markdown blog post for Astro.
Iโ€™ll keep it clean, structured, and blog-ready.

Hereโ€™s the Markdown draft โฌ‡๏ธHereโ€™s a polished version of your text with grammar, clarity, and flow improved while keeping your voice intact:

Through a lab on โ€œStatic and Dynamic IP addressesโ€, I was able to identify the cause of my EC2 instance changing its public IP address every time I stopped and restarted it.

In the lab scenario, a customer reached out to an AWS Cloud Support Engineer (CSE) for help with a networking issue: their EC2 instanceโ€™s public IP kept changing whenever they started and stopped it. As the CSE, my task was to investigate and resolve the problem.

This sounded very similar to what I experienced over the weekend when I created an EC2 instance to set up an n8n instance. After completing the installation and confirming everything was working, I stopped the instance and left it. On Sunday, I restarted the server and tried to access my self-hosted n8n instance through the domain name I had attached, but it wasnโ€™t accessible.

Confused, I checked my Portainer dashboard (I used Portainer as my server admin dashboard to deploy containers via stacks). Looking at the n8n container logs, I noticed it couldnโ€™t ping the domain name. So I compared the EC2 instanceโ€™s public IP with the one in my Cloudflare DNS settings and realized they were different. After updating Cloudflare with the new IP and waiting a few minutes, everything worked again. I didnโ€™t stop the server afterward because I was worried about breaking it.

It turned out that I needed to create an Elastic IP (EIP) and assign it to my instance. After finishing the lab, I went back to the AWS console, opened the EC2 dashboard, and noted my current IP address. Then I navigated to the Elastic IP section, generated a new EIP, and assigned it to my instance. After a short restart, I saw the new IP reflected. To confirm, I stopped and restarted the instance again, and this time the IP stayed the same. Problem solved! I then updated my Cloudflare DNS settings to point to the new static IP.

Interestingly, the study group I was part of also did a class presentation on Internet Protocols, covering Static, Dynamic, Public, and Private addressesโ€”exactly the concepts I had just experienced in practice.

Continue reading...
 


Join ๐•‹๐•„๐•‹ on Telegram
Channel PREVIEW:
Back
Top