Deploy to EC2 from GitHub Actions without opening port 22
dev.to·
Standard deployment patterns from CI/CD pipelines to cloud instances frequently rely on storing SSH private keys in repository secrets and opening inbound port 22 on the target server. This guide details a more secure deployment alternative using AWS Systems Manager (SSM) Run Command directly within GitHub Actions. Because the SSM Agent running on the EC2 instance establishes an outbound connection to AWS, deployment commands can be dispatched securely through the AWS SSM API without exposing inbound SSH access to the internet. Securing deployment pipelines by eliminating open ingress ports is a core practice in cloud platform engineering and infrastructure architecture.