The server was live, the clock was ticking, and there was no room for mistakes. You needed secure remote access to AWS fast—without punching holes in firewalls, juggling VPNs, or exposing a single port to the public internet. The AWS CLI could do it. You just had to make it airtight.
Secure remote access with AWS CLI is not about convenience. It is about control. Every command, every credential, every endpoint must be locked down. This means using temporary credentials, encrypting all traffic, and relying on AWS-native services that eliminate unnecessary network exposure.
The first step is simple: never store Access Keys in plain text. Use AWS IAM roles with fine-grained permissions. Rotate them automatically. Issue only the minimum privileges required for the task. Short-lived session tokens from aws sts assume-role provide another layer against compromise.
The second pillar is network isolation. For EC2 instances, require connection only through AWS Systems Manager Session Manager. This removes the need for SSH over the open internet. It routes all communication through secure AWS-managed channels, encrypts it end-to-end, and logs every interaction to CloudWatch or S3 for audit trails. No inbound ports. No public IPs. Just a clean, auditable path in.