View a markdown version of this page

SEC06-BP03 Reduce manual management and interactive access - AWS Well-Architected Framework

SEC06-BP03 Reduce manual management and interactive access

Interactive login is the traditional way to configure, patch, and troubleshoot a server. A listening remote-access service is a path an unauthorized user can target, and manual steps invite human error and shared credentials. Capturing management actions as automation, and reserving direct access for emergencies, reduces the attack surface and the chance of an unintended change.

Desired outcome:

  • Your scripts and automation documents (runbooks) capture the authorized actions on your compute resources.

  • Your runbooks run automatically on change detection, or manually when human judgment is required.

  • You allow direct access to compute resources only in emergencies, when automation cannot perform the task.

  • You log and review every manual action, and the review feeds improvements to your automation.

Common anti-patterns:

  • Operators reach instances interactively over SSH or RDP as a matter of routine.

  • Instances maintain individual local logins, such as entries in /etc/passwd or Windows local users.

  • A shared password or private key gives several people access to the same instance.

  • Teams install software, change configurations, and apply patches manually.

  • Engineers log in to instances to troubleshoot problems rather than collecting data through automation.

Benefits of establishing this best practice:

  • Automated actions reduce the operational risk of unintended changes and misconfigurations.

  • Removing SSH and RDP for routine access closes a common path for unauthorized actions.

  • Runbooks define the full scope of authorized activity, which you can audit at a fine-grained level.

  • Emergency-only access with logging keeps a clear record of the rare times a person touched a resource.

Level of risk exposed if this best practice is not established: Medium

Implementation guidance

Say you installed an operating system, logged in to configure it, and returned over its lifetime to patch, reconfigure, and troubleshoot. That lifecycle requires a listening service such as SSH or RDP that an unauthorized user can probe. Manual steps cause incidents and data loss, and shared or distributed credentials add management overhead and weaken accountability.

In an outbound-connection model, a lightweight software component on the instance opens an encrypted channel outward to a managed service. The instance no longer listens for inbound sessions, so no port needs to be open. You can route the channel over a private network path instead of the public internet. Control moves from network reachability and key possession to identity and policy, with a central system deciding who runs which action, and under what conditions.

Most management tasks such as applying a patch, installing software, or changing a configuration, can run as a defined document with no person at a prompt. Reserve interactive sessions for cases where judgment is required, and log every command and its output. Recording automation invocations and session activity gives you an audit trail of who took action on your resources.

On AWS, AWS Systems Manager implements this pattern. The SSM Agent initiates the encrypted channel, so no instance needs to listen for inbound SSH or RDP, and you can configure it to connect over a VPC endpoint. Systems Manager decides which automations run, who runs them, and when. When an interactive session is unavoidable, Session Manager provides it and logs the activity, and AWS CloudTrail records the API calls.

Implementation steps

  1. Install the SSM Agent: Install AWS Systems Manager Agent on your Amazon EC2 instances, and check whether it is already included and started as part of your base AMI.

  2. Grant the instance profile permission: Verify that the IAM roles in your EC2 instance profiles include the AmazonSSMManagedInstanceCore managed policy so Systems Manager can manage the instance.

  3. Disable interactive remote-access services: Turn off SSH, RDP, and other remote-access services on your instances by running scripts in the User Data section of your launch templates, or by building custom AMIs with EC2 Image Builder.

  4. Close inbound access at the network layer: Confirm that security group ingress rules do not permit port 22/tcp (SSH) or port 3389/tcp (RDP), and detect and alert on misconfigured security groups with AWS Config.

  5. Define and scope automations: Create automations, runbooks, and run commands in Systems Manager, and use IAM policies to define who can run them and under what conditions. Test them in a non-production environment, and invoke them instead of logging in to the instance.

  6. Provide logged interactive access for emergencies: Use Session Manager when interactive access is necessary, and turn on session activity logging to Amazon CloudWatch Logs or Amazon S3.

Resources

Related best practices:

Related documents:

Related tools: