The Simplest Way to Make Ec2 Systems Manager and SAML Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Using ec2 systems manager and saml lets teams log in to servers with corporate identities. This pairing removes shared keys and ties every server command to a real user. In production, an engineer logs in to an identity provider first. The provider sends a signed assertion to the cloud account. The cloud account then grants a temporary role that opens a server session. Admins do not need to open inbound network ports or hand out static keys. How ec2 systems manager and saml pass identity and

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Using ec2 systems manager and saml lets teams log in to servers with corporate identities. This pairing removes shared keys and ties every server command to a real user.

In production, an engineer logs in to an identity provider first. The provider sends a signed assertion to the cloud account. The cloud account then grants a temporary role that opens a server session. Admins do not need to open inbound network ports or hand out static keys.

How ec2 systems manager and saml pass identity and roles

The login flow starts at your identity provider. A user asks to log in to a cloud account. The provider checks the user password and multi-factor token. Next, the provider builds a signed XML assertion with the user group data. The browser sends this assertion to the cloud sign-in endpoint.

The cloud service reads the assertion and trusts the identity provider. It matches the user group to a specific cloud role. That role holds rules that say which servers the user can reach. The user then starts a session through the management agent on the host.

During the session, the agent runs commands on the server. The cloud service can pass user attributes from the assertion into the session. Teams use these attributes to tag logs and match server tags. If a server tag matches the user team tag, the session starts.

Common failure modes and how to scope roles

Many teams map every user to one broad cloud role. This shared role gives everyone the same high level of power on hosts. When five engineers share one role, audit logs show the same role name. It becomes hard to see which person ran a bad command.

Another common risk comes from long session times in the assertion. If a token stays valid for twelve hours, a stolen token works all day. Teams also forget to log the output of commands run inside the host. Without command logs, you only know a session happened, not what changed.

SAML 2.0 + GCP Access Context Manager: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix these issues, scope cloud roles to small tasks and specific server tags. Map each identity group to a distinct role with the least needed rights. Set short token lifetimes in both the identity provider and the cloud role. Turn on full session logging and send those logs to a locked storage bucket.

Managing host user accounts and network paths

Even with federated login, the agent often drops users into one local host account. If three users share that local Linux or Windows account, they share local files. One user can read or change files left behind by another user. You can set up the agent to map each session to a separate local user.

Network paths also need tight rules. The host agent talks outbound to cloud endpoints over HTTPS. Place your servers in private subnets with no public IP addresses. Use private cloud endpoints so session traffic stays inside your private network. Restrict outbound traffic from the server so it cannot reach unknown internet hosts.

Review your trust rules between the identity provider and the cloud account often. Remove old roles when projects end. Check that every role requires a valid assertion attribute before granting a session. This keeps your server login path clean and easy to audit.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How do we track which user ran a command in a shared role?

Pass a source identity attribute inside the login assertion from your identity provider. This attribute attaches the individual username to every cloud log entry for that session.

Can we restrict server sessions by team without making hundreds of roles?

Yes, you can pass team tags inside the assertion attributes during login. Write one role rule that only allows sessions on servers with matching team tags.

What happens to an open server session when the assertion expires?

Active sessions can keeps the session active unless you set a session duration limit in the manager settings. Always set both the role token limit and the agent session timeout to match.

The query runs. The emails stay hidden.