Using Contrail in a team
How to roll Contrail out to a team: what each person needs, which AWS permissions to hand out, what it costs, and what your services’ logs should look like to get the most out of it. There is nothing to run centrally: each person installs the app and uses their own AWS login.
What each person needs
Section titled “What each person needs”- Contrail (Download). It updates itself; the update check can be switched off in Settings → About → Updates.
- Optionally the AWS CLI v2:
Contrail runs
aws sso loginfor you when it’s installed, and logs in itself otherwise (a code to confirm in the browser; the token goes to the CLI’s cache). - AWS profiles in
~/.aws/config. SSO profiles (IAM Identity Center) are the main case; profiles with assume role,credential_processor static keys work too, because the AWS SDK resolves them like the CLI does.
Share the AWS config
Section titled “Share the AWS config”Most teams already have a shared ~/.aws/config snippet, or can make one with aws configure sso. One
sso-session and a profile per account and role is all Contrail needs:
[sso-session company]sso_start_url = https://example.awsapps.com/startsso_region = eu-central-1sso_registration_scopes = sso:account:access
[profile orders-dev]sso_session = companysso_account_id = 111111111111sso_role_name = ReadOnlyregion = eu-central-1
[profile orders-prod]sso_session = companysso_account_id = 222222222222sso_role_name = ReadOnlyregion = eu-central-1Profiles that share an sso-session share one login. Using the same profile names across the team helps when
people talk about “orders-prod” or share a screenshot; Contrail keeps favorites and recent services per profile name.
Permissions
Section titled “Permissions”Contrail only reads, unless you allow changes. Admin and broad read-only roles usually cover reading; for narrower roles, give
docs/iam-policy.json to whoever manages your SSO permission sets (also on the
AWS permissions page):
ContrailReadOnlyis what everyone needs: ECS describe/list, reading log events and Live Tail.ContrailOptionalRevealSecretsonly to show values of secret environment variables. Leave it out, or narrow itsResourceto the secrets the team may read; every read is in CloudTrail.ContrailOptionalInsightsTraceonly for tracing across many services with Logs Insights.ContrailOptionalChangesonly for teammates who may stop tasks and update services from Contrail (they also turn on Allow changes to AWS in the settings).
A role without ContrailOptionalChanges can’t change anything, whatever the app does.
What it costs
Section titled “What it costs”Contrail is free; the AWS calls it makes are billed to your accounts like any other use:
- Live Tail is billed per session minute. Contrail keeps that low by default: a view only follows live while its
time window is 15 minutes or shorter, tails of views you haven’t looked at for 10 minutes pause, and all tails
pause 30 seconds after Contrail is hidden (resuming with a catch-up when you’re back). The limits are in
Settings. Without the
logs:StartLiveTailpermission, Contrail checks for new events every 2 seconds instead. - Logs Insights (optional, for tracing across many services) is billed per GB scanned. It is only used when you
tick Use Logs Insights in the trace dialog; the default trace search uses
FilterLogEvents. - Reading log events and describing ECS resources are ordinary API calls.
See CloudWatch pricing for the current prices.
Logs that work well
Section titled “Logs that work well”Contrail reads the log group from the task definition, so services need the awslogs log driver with an
awslogs-stream-prefix. Beyond that, the more structure your logs have, the more Contrail can do:
- ECS JSON (Elastic Common Schema, nested or with dotted keys, as written by
logback-ecs-encoderand similar) gives levels, loggers, threads, fields and stack traces. Spring Boot’s default console pattern and plain text work too, with less structure. - Other JSON field names can be mapped per service (the Field mapping button in the log toolbar), so
lvlormsgwork likelog.levelandmessage. Mappings are saved on each machine. - Correlation or trace IDs (
correlationId/correlation_idortrace.id/traceId/trace_id, alone or under any prefix, or Spring’s[traceId-spanId]; a correlation ID wins when an event has both) enable the correlation column and tracing across services: logging the same ID in every service a request passes through is what makes that work. - Stack traces that CloudWatch split into one event per line are joined again; logging them inside the JSON
event (
error.stack_trace) is still better.
Search syntax describes what you can search for once the fields are there.
Trying it without AWS
Section titled “Trying it without AWS”CONTRAIL_DEMO=1 (or --demo) starts Contrail with invented profiles, clusters and live logs and makes no AWS
calls at all. It is a quick way to show the app to a team before anyone sets up permissions.