Amazon since Feb 2024 has started charging for the public ipv4 address allocation . Approximately it charges $4 to $5 per month which comes out to $40 to $50 per year . By default , when a AWS EC2 instance is created , public ipv4 address is automatically allocated. There may be few applications which may not need public ipv4 address , AWS offers an option to disable through few settings .
To disable ipv4 public IP auto setting
- Login to AWS console
- Select the link - EC2 - Instances - Actions - Networking - Manage IP address
- Select and expand the network interface , disable the option
- Restart the instance and confirm if public ipv4 address is not loaded automatically
Usually above settings are sufficient to disable auto assigned public IP. In case if still found loading , disable this setting in the subnet option also as below
- Login to AWS console
- Select the link - EC2 - Instance - Subnet settings - Edit Subnet settings
- Uncheck the checkbox option under the heading "Enable auto-assign public IPv4 address"