Alye / Resources
Guide

How to connect AWS for read-only security scanning

By the Alye team · Updated

Short answer
Create an IAM role in your account that only the scanner's AWS account can assume, and only with an external ID unique to you. Attach AWS's SecurityAudit and ViewOnlyAccess managed policies. The scanner can then read configuration but can't create, change or delete anything, and every call it makes shows up in your CloudTrail.

Why a role, not access keys

Access keys are long-lived secrets that have to be stored, rotated and eventually leak. A cross-account role gives the scanner short-lived credentials each time it scans, and you can remove access at once by deleting the role. Nothing secret is shared in either direction.

What the external ID is for

The role's trust policy allows one principal, the scanner's role in its own AWS account, and requires an external ID that is unique to your organization. Without it, anyone else using the same scanner could ask it to scan your account if they learned your role's ARN (the confused-deputy problem). With it, only scans made for your organization can assume your role.

Which permissions it needs

Two AWS managed policies cover it:

  • SecurityAudit: read access to security configuration across services: IAM policies, security groups, encryption, logging settings.
  • ViewOnlyAccess: list and describe access to resources across services, without reading their data.

Neither policy allows create, update or delete actions, and neither lets the scanner read the contents of S3 objects, databases or Secrets Manager secrets. Using AWS's managed policies also means they stay current as AWS adds services.

Connecting, step by step

  1. In the scanner, start connecting AWS. It shows its AWS account ID and your external ID.
  2. Launch the CloudFormation stack it gives you (or apply the equivalent Terraform). The stack creates one IAM role, AlyeSecurityReadOnly, with the trust policy and the two managed policies.
  3. Copy the role ARN from the stack's Outputs tab back into the scanner.
  4. The scanner checks it can assume the role and read, then starts the first scan.

Every account in an AWS Organization

Deploy the same template as a service-managed CloudFormation StackSet to the organization root. New accounts get the role automatically. StackSets skip the management account, so deploy the stack there once by hand if you want it scanned too.

Auditing and removing access

Every API call the scanner makes appears in your CloudTrail under the role's name, so you can see exactly what was read and when. To remove access, delete the CloudFormation stack, or the role itself. The next scan fails to assume the role and stops. For what the scan does with the configuration it reads, see what CSPM is.

Questions

Can a read-only scanner change anything in my AWS account?

No. SecurityAudit and ViewOnlyAccess contain only read, list and describe actions. Fixes are applied by you, in your own tools; Alye can optionally use a separate fix role you create, only for changes you approve.

Does the scanner read my S3 files or database rows?

No. The policies allow reading bucket and database configuration, not their contents. Alye knows a store holds sensitive data from the tags you put on it.

I deleted the stack but the role is still there. Why?

If the role was created outside the stack, or the stack deletion failed, the role stays. Check the stack's Events tab, then delete the role in IAM if needed.

Does scanning cost anything on my AWS bill?

Reading configuration uses AWS APIs that are free in almost all cases. Some services count API calls against rate limits, which a scanner should respect.

See it on your own cloud. Connect one AWS account read-only in a few minutes and see your first ranked list.

Get started

Ready to put Alye on duty?

First trace right away. First ranked scan in about fifteen minutes.

Start free Read the docs