pcg
pcg

Reputation: 61

AWS - How to allow only ip addresses from only a specific country to access EC2

I would like to block all ip addresses accessing my EC2 instance through RDP/SSH from all other countries except the local country. Is it possible to do this?

Upvotes: 4

Views: 2040

Answers (1)

Adiii
Adiii

Reputation: 60094

EC2 security does not provide this functionality out of the box, but you can use other utilities to restrict access base on location.

you can try ssh-geoip-filter that work like charm all you need to specify allowed countries in the ssh filter.

# UPPERCASE space-separated country codes to ACCEPT
ALLOW_COUNTRIES='US DE IT AT CH NL PK ES US'

Another option is that you cam check pam_geoip-restrict-accounts-to-certain-citiescountrys-only

Upvotes: 1

Related Questions