Disable UFW on AWS EC2 using AWS Console

There is way to disable ufw from AWS console without using any SSH client.
Disabled ufw on AWS console
568 Views

Hi guys 😎! It’s been a long time since my last post but, “Better Late Than Never”. So we are talking today about UFW. I have lots of friends who ask me how to disable UFW in AWS Ubuntu as they could not do SSH to the server. So, I decided to come up with this topic.

It’s quite simple to disable UFW in AWS Ubuntu from the AWS console without using SSH.

So basically, UFW stands for Uncomplicated Firewall, a default firewall configuration tool for Ubuntu. UFW provides a user-friendly way to create an IPv4 or IPv6 host-based firewall. By default, UFW is disabled.

So now let’s see how to disable it through the AWS console without using any SSH client.

Here are the steps, 

  • Login to your AWS console and go to the EC2 page
  • Select the EC2 instance, stop the instance
Stop EC2 Instance
Stop EC2 Instance
  • Right-click the EC2 instance, go Instance settings then Edit user data.
Edit EC2 Instance
Edit EC2 Instance
  •  Paste below code to Modify user data as text then save (you may remove sudo).

Add ufw disable code
Add ufw disable code
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
cloud_final_modules:
- [scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
#!/bin/bash
sudo ufw disable
sudo iptables -L
sudo iptables -F
--//
  1. Restart your instance
  2. Verify your public IP address (normally it will be changed after your stop & restart)
  3. SSH to the EC2 instance with a new IP address.

Thas it. Now you can access SSH using the new IP address. 😎

Total
0
Shares
Previous Post
Display Post View Count In WordPress Without Plugin

Display Post View Counts In WordPress 😃

Next Post
Advanced PHP tips & tricks

Advance PHP Tricks and Tips Part One

Related Posts