Using GitHub Actions to deploy to AWS EC2


I’m struggling a bit finding a reasonable solution to deploy my code from GitHub to AWS EC2 servers using actions. When I open up my AWS EC2 security group SSH port to the world, then everything works fine. But for obvious security reasons I don’t want this. Adding about 1400 CIDR GitHub IP ranges ( to an AWS security group seems unreasonable and inefficient. Can you help me with this by providing some pointers?

FYI. I’m using alternate Git Cloud Repositories and their CIDR IP ranges is very small compared to GitHub. Thus, creating Firewall rules for these alternates servers is no big deal.

Thank you,