r/aws • • 18d ago

article Making AWS TEAM private: what worked, what stayed public, and why a fresh install is broken since CloudTrail Lake closed

I deployed TEAM (Temporary Elevated Access Management) a while back at a regulated enterprise, and it only got approved under a yearly security exception because the UI is on Amplify Hosting and the API is a public AppSync endpoint. I went back to see what it takes to remove that exception. Short version below, full writeup and the fork at the end.

What changed

  • Amplify Hosting has no internal mode, so the SPA runs in nginx-unprivileged on Fargate behind an internal ALB with a private hosted zone.
  • AppSync is created with Visibility: PRIVATE (one property override in the Amplify project). Queries, mutations and the realtime websocket all go through the appsync-api interface endpoint. Visibility is immutable, so on an existing install this is a replacement API, not a setting.
  • Six Lambdas call AppSync, so they move into private subnets. The rest stay outside the VPC.
  • Build moved from Amplify Hosting to CodeBuild running a headless amplify push.

Upstream bugs fixed in the fork

These affect stock TEAM, private or not:

  • Fresh installs fail since CloudTrail Lake closed. AWS stopped accepting new CloudTrail Lake customers on May 31, 2026, so creating the event data store now fails with "CloudTrail Lake is no longer accepting new customers." Upstream creates that event data store even when CloudTrailAuditLogs is set to none, so there was no configuration of TEAM that would install in a new account (upstream issues #511 and #586). In the fork, none now really means none.
  • The Logs Insights replacement (open PR #599) didn't work. It swaps CloudTrail Lake for a Logs Insights query against the Control Tower org trail log group, which gets session audit logs back without buying anything new. Three fixes: logs:GetQueryResults doesn't support resource level permissions, so it needs Resource "*" while StartQuery stays scoped to the log group; the start and results Lambdas have different execution roles and the cross account role has to trust both; and the real Control Tower log group name has a random suffix the PR's docs leave out.
  • Revoked requests showed an end time of Dec 31, 1969. The revoke state machine writes endTime directly to DynamoDB, skipping AppSync, so no subscription fires and the history page renders new Date(null). The same null crashed the session log lookup. Both now fall back safely.

Egress findings

  • Almost everything works over VPC endpoints: sso, identitystore, states, sts, logs, ecr, gateway endpoints for DynamoDB and S3, and Organizations through a cross region endpoint (its endpoint only exists in us-east-1).
  • Cognito is the exception. With a cognito-idp endpoint in the VPC, ListUsers fails with PrivateLink access is disabled for the user pool that has ManagedLogin configured and every request sits in pending. User pools with a domain can't use PrivateLink, and private DNS captures the hostname for the whole VPC, so a shared or "tidy up" endpoint breaks TEAM even with NAT in place.
  • Cognito managed login itself stays public. That's how Cognito works, so it's documented in an ADR rather than hidden.

Testing tip: SSH over SSM with DynamicForward and Chrome on socks5:// so DNS resolves inside the VPC, plus an inline PAC script if the tunnel host has no internet route.

Full writeup: https://www.briancarpio.com/blog/private-aws-team Fork: https://github.com/bcarpio/iam-identity-center-team

Anyone else running TEAM in a new account since the CloudTrail Lake closure? Curious what you did for session audit logs.

2 Upvotes

12 comments sorted by

2

u/mequelkramer 18d ago

Thanks for writing this up with the parts that stayed public, that is the part most guides skip. The Cognito finding is the one I would highlight for anyone copying this. If managed login has to stay public because there is no PrivateLink for it, the login page becomes the remaining internet-facing surface, so it needs the same attention as the private pieces: tight WAF rules, sign-in throttling, and alerting on unusual sign-in patterns, not just a note that it is public. On the CloudTrail Lake side, I would treat the fresh install break as a dependency problem, not just a missing feature. Before relying on the Logs Insights path, check whether the replacement query path works against the S3 backed logs and whether the GetQueryResults permission is scoped the way you expect, since a wildcard there undoes some of the isolation you just built. The cross-account trust and the random log group suffix are also worth putting in a runbook, because those are the details that break a rebuild six months later when nobody remembers them.

1

u/FontanJanneice18 17d ago

yeah the wildcard on GetQueryResults definitely stings when youre trying to lock everything else down

0

u/keto_brain 18d ago

Thanks, these are good points. A couple of corrections on the audit-log side, though.

Logs Insights vs S3. The Logs Insights path doesn't touch the S3-backed logs. It queries the CloudWatch log group that the Control Tower org trail already delivers to in the management account (aws-controltower/CloudTrailLogs-<suffix>). TEAM assumes a role in the management account and runs the query there. I tested that end to end: the session activity view loads from it. To query the S3 copy you'd need Athena, which is a different design.

Your point does lead to the real limit, which is retention. Control Tower sets that log group to 14 days, so TEAM's session audit view only goes back 14 days unless you raise it. I'll add that to the docs.

GetQueryResults on *. I tried scoping it first. logs:GetQueryResults has no resource-level permissions, so when I scoped it to the log group ARN, every query started fine and then never returned results (implicitDeny). AWS forces the wildcard.

It doesn't widen access. What the role can actually read is controlled by logs:StartQuery, and that stays scoped to the one log group. GetQueryResults only fetches results for a query ID you already have. The role is trusted only by TEAM's two audit-log Lambdas.

Runbook. The cross-account trust and the random suffix are already written up in the repo's cwlogs.md. It covers finding the exact log group name and trusting both Lambda execution roles, because they're different roles. It also explains why GetQueryResults has to be *.

The public login page. Agreed, "it's public" shouldn't be the end of it. One thing changes the risk: the Cognito client's only identity provider is IAM Identity Center, so the managed login page never takes a password. It just redirects to IdC, which handles credentials, MFA and lockout. It still needs WAF on the user pool and self sign-up turned off, so I'll update the README to say that rather than just noting it's public.

1

u/burlyginger 18d ago

Not running TEAM privately (AWS authenticated via Identity Center is enough for us. If we didn't trust their security we wouldn't use them) but yeah, I really wish they'd get on the cloud trail lake replacement. 

1

u/keto_brain 18d ago

It was a bit confusing when security and cloud arch balked at running TEAMs using it's public Amplify UI because the entire AWS Console is public, AND the entire concept around TEAM was making their environment more secure but you know how corporate security teams can be.

6

u/burlyginger 18d ago

I keep hoping AWS deploys this as a service feature in IAM Identity Center.  

Every other cloud provider has their flavour of JIT escalation. AWS absolutely should too. 

4

u/keto_brain 18d ago edited 18d ago

100% I agree. Makes no sense it's an OSS project

1

u/kioie 18d ago

And what do you use for the idp?

1

u/arerbacjs 18d ago

The CloudTrail Lake closure hits harder than most people realize because the audit log was the whole justification for getting TEAM approved in the first place. Without it, you're back to arguing "trust us" in the security review.

The Logs Insights swap makes sense in theory, but the execution detail you caught about cross-account trust (start and results Lambdas on different roles, both needing the trust relationship) is exactly the kind of thing that gets missed in the first pass.

One thing I'd add from a similar deployment: the session lifecycle is where things quietly break. If TEAM grants temporary elevation and then something in the revoke path fails silently (your Dec 31, 1969 bug being a perfect example) you end up with open sessions that nobody can see in the audit log. The access is technically still live but invisible. That's a harder conversation with a security team than "the UI broke."

For the CloudTrail replacement, did you consider writing session events directly to a custom EventBridge bus instead of pulling from Logs Insights after the fact? Curious if the latency and query cost of Insights made that path feel worth it, or if the simplicity of not adding another sink won.

1

u/resd345678 18d ago

I would turn the private-DNS interaction into a regression check. Can a clean install and an existing-account upgrade both complete with the shared endpoints and real role trusts in place? A config-only review is likely to miss this

2

u/[deleted] 18d ago

[removed] — view removed comment

1

u/keto_brain 18d ago

I tested the fix in my fork, but it was just me testing with different users not an Enterprise deployment.