It started with a customer’s question
A customer asked me whether LogRaker could follow the EC2 instances behind their load balancers, which come and go all day long as their Auto Scaling groups grow and shrink. It can’t yet (that’s what I’m working on next), but while I was planning it, I ran into something more basic first: how LogRaker signs in to AWS in the first place.
Until now, an AWS Source signed in with an access key, either pasted into the Source’s editor or read from a profile in your ~/.aws/credentials. Both are long-lived keys, and plenty of companies don’t hand those out anymore (and for good reason). Instead they sign their people in through AWS IAM Identity Center, formerly known as AWS SSO, with the same company login they use for everything else. For those folks, LogRaker was a non-starter.
And, full disclosure, I was still signing in to my own AWS account as root… yes, I know. So I fixed both: I set up IAM Identity Center for myself, and I taught LogRaker to use it.
Signing in with IAM Identity Center
In an Amazon CloudWatch or Amazon S3 Source’s editor, choose ‘Identity Center’ under Auth, and enter your organization’s Start URL (the address of your AWS access portal, something like https://my-company.awsapps.com/start) and the region it lives in. Then click ‘Sign In…’.
Your browser opens your company’s AWS sign-in page with a short code on it, and LogRaker shows the same code right next to the button, so you can check that the two match. Click ‘Confirm and continue’, sign in if it asks you to, click ‘Allow’, and LogRaker comes back to the front with the Account and Role menus filled in with whatever your company lets you use. Pick one of each, click ‘Test Connection’, done.
The sign-in stays on your Mac, in your Keychain, and every Source with the same Start URL shares it. Your Sources still sync to your other Macs through iCloud, but each Mac signs in once on its own, on purpose: a sign-in that opens every AWS account you have shouldn’t be floating around anywhere it doesn’t need to be.
The Safari gotcha
My first version signed in exactly like the AWS CLI does by default, where AWS sends your browser back to a little web server LogRaker runs on your own Mac. It worked fine, except that every single time I clicked ‘Allow’, Safari popped up “This is a non-secure form.” Not exactly what you want to see in the middle of signing in to your company’s AWS accounts.
The culprit is AWS’s own page, which sends a form to a plain http://127.0.0.1 address, and AWS won’t take any other address for it (I tried). So I switched to the other sign-in AWS offers, the one with the code (the CLI calls it --use-device-code), and the warning is gone for good, along with the little web server.
Then there was the browser that kept opening behind LogRaker’s window. Since macOS 14, an app only comes to the front when the app in front explicitly hands it over (Apple calls it cooperative app activation), and I didn’t, so I sat there waiting for a sign-in page I couldn’t see… Fixed that too.
When the sign-in runs out
A company sign-in doesn’t last forever, 8 hours unless your administrators changed it, so sooner or later it runs out while your Streams are still running. When that happens, LogRaker doesn’t turn them red. They stop and wait, with a key next to them in the sidebar where the activity waveform usually is, and a strip above their lines tinted in your accent color that says ‘Sign In…’. One click, one confirmed code, and every Stream that was waiting for that sign-in starts up again on its own. If LogRaker is in the background when that happens, it sends you one notification (if you allow it to).
Settings ▸ Security now has an AWS Sign-Ins list too, with every Start URL your Sources use and whether this Mac is signed in to it, so you can sign out when you’re done.
Roles, and your AWS CLI profiles
Plenty of AWS setups don’t stop at signing in: you sign in, and then you work as an IAM role, often in another account. So any AWS Source can now ‘Assume role’ too, with the role’s ARN and an External ID if the role asks for one, no matter how you signed in. The role’s credentials last an hour, and LogRaker renews them before they run out, so you never notice.
And if you already use the AWS CLI, you’ve probably set all of this up before in your ~/.aws/config. The small menu button at the end of the Auth row now lists the profiles in that file, each with how it signs in, and picking one fills in the whole sign-in for you: the Identity Center account and role, or the profile, plus the role to assume and the region. Profiles LogRaker can’t sign in like (say, one that runs a credential_process) show up grayed out, with the reason right next to them.
A couple of fixes along the way
Under the hood, LogRaker now asks for fresh credentials before every request it sends to AWS, which also fixed two old annoyances. If a tool like saml2aws renews the temporary keys in your ~/.aws/credentials, your Streams keep running instead of failing until you save the Source again. And if your Mac’s clock is off by a few minutes, AWS used to refuse every request, while now LogRaker takes the time from AWS’s answer and carries on.
So, if your company signs you in to AWS through IAM Identity Center, give LogRaker 3.8 a try. All the details are in the docs for IAM Identity Center, assuming a role, your AWS CLI profiles and your AWS sign-ins.
Thanks for reading!