Detection scenarios
How do I detect an attacker in my AWS environment?
Detecting an attacker in AWS: direct answer
Detect an attacker in AWS by watching for credentials used from somewhere they should not be, enumeration of IAM and resources, new access keys or policy changes, attempts to switch off logging, and reads of secrets or data a principal has never touched. CloudTrail records those API calls, GuardDuty scores many of them, and canary credentials and resources add the one signal with no legitimate explanation, because nothing real ever uses them. Tracebit, a deception technology platform that detects attacks in your environment at scale, deploys those canaries across AWS as infrastructure as code. The security team at Coveo, an AI-powered enterprise search and relevance platform, stood up dozens of decoys that way from a seven-line Terraform module.
Signals that an attacker is in your AWS environment
| Signal | Where it shows up | What to look for | Noise |
|---|---|---|---|
| Credentials used from the wrong place | GuardDuty | UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS, CredentialAccess:IAMUser/CompromisedCredentials | Low. On-premises egress can trigger the first |
| Identity probe | CloudTrail | sts:GetCallerIdentity from a new IP or user agent, often the first call made with a stolen key | High alone, useful in sequence |
| Enumeration | CloudTrail, GuardDuty | iam:GetAccountAuthorizationDetails, ListRoles, ListBuckets, ec2:DescribeInstances across regions, runs of AccessDenied, Discovery:IAMUser/AnomalousBehavior | High. Administrators and CSPMs make the same calls |
| Credential access | CloudTrail, GuardDuty | secretsmanager:GetSecretValue, BatchGetSecretValue by an unusual principal, CredentialAccess:IAMUser/AnomalousBehavior | Medium |
| Privilege escalation and persistence | CloudTrail, GuardDuty | iam:CreateAccessKey, CreateUser, AttachUserPolicy, PutUserPolicy, UpdateAssumeRolePolicy | Medium. Pipelines do this legitimately |
| Logging tampered with | CloudTrail, GuardDuty | cloudtrail:StopLogging, DeleteTrail, PutEventSelectors, guardduty:DeleteDetector, Stealth:IAMUser/CloudTrailLoggingDisabled | Low. Alert on every one |
| Data collection | CloudTrail data events, GuardDuty | Spikes in s3:GetObject, plus CreateSnapshot or PutBucketReplication by an unusual principal | Medium. Object reads need data events |
| Canary touched | CloudTrail, routed to an alert | Any use of a canary access key, role, bucket or secret | Very low. Nothing legitimate uses it |
Read these as a sequence. A GetCallerIdentity call followed by IAM enumeration and a new access key tells a story that none of the three tells alone. GuardDuty's anomaly findings also have a documented limit: if activity from a remote host continues, the model learns it as expected and stops raising the finding for that host. A canary has no baseline to drift, so the first touch and the hundredth carry the same meaning.
Building the canary signal in AWS: four pieces, and where they go wrong
Almost every AWS API call generates a CloudTrail event, but that event only reaches anything useful if a trail with logging enabled exists in the account — EventBridge doesn't receive AWS API call events without one. From there, an EventBridge rule needs a JSON event pattern that matches the specific principal, access key, or resource the canary cares about. Read-only management events, which include calls such as GetSecretValue, only reach a rule whose state is ENABLED_WITH_ALL_, so a canary secret wired to a plainly enabled rule stays silent. The last piece, a target that actually notifies someone, ranges from the simplest version, SNS straight to an email address, to the version most teams actually keep running long-term: SNS into a Lambda that posts to Slack or Teams, or directly into PagerDuty.
The distinction that silently breaks the most canaries
One AWS-specific detail causes more quietly-failed canaries than anything else: the difference between management events and data events. Management events cover control-plane operations — IAM changes, sts:GetCallerIdentity, bucket creation and policy changes — and AWS logs these by default. Data events cover high-volume, data-plane operations like s3:GetObject, s3:PutObject, or DynamoDB item reads, and AWS does not log these by default, because of the added logging cost at scale. A canary built around a decoy S3 bucket, expecting to catch someone reading a file out of it, will never fire unless S3 data events are explicitly enabled for that specific bucket. Management-event logging alone will never surface an object-level read. Getting this distinction backwards is the single most common reason a hand-built AWS canary looks like it's working right up until the moment it doesn't.
What a working canary actually catches
Once the plumbing is correct, the canary itself doesn't need to be complicated to be effective. A fake IAM role that looks like it can deploy to production, a decoy S3 bucket that looks like it holds billing exports, a Secrets Manager entry that looks like it unlocks a database: none of them have any legitimate reason to be touched by anything real. Any interaction, whether from a stolen credential, a compromised piece of software, or an insider rooting around outside their scope, produces the same high-confidence signal regardless of how the attacker got there.
Scarcity is what gets the alert acted on. One Tracebit customer running a large, noisy AWS estate prioritised a rare canary alert, identified a compromised identity and rotated access within thirty minutes. The post-mortem found other tooling had flagged the same event and nobody had acted on it, because that tooling alerted constantly.
Why coverage is the harder problem than the first canary
Standing up one canary in an afternoon is genuinely not the hard part. The harder problem is what happens next: a real AWS estate spans many accounts, and a canary that isn't kept fresh, doesn't match evolving naming conventions, or only covers a handful of resources leaves most of the environment unwatched. That's the gap Tracebit's automation is built to close, deploying canaries as infrastructure-as-code across every account the same way the rest of the environment is provisioned, rather than as a one-off project that stops scaling the moment nobody's actively maintaining it.
The bottom line on detecting an attacker in AWS
Detecting an attacker in AWS takes three layers working together: CloudTrail for the record of what happened, GuardDuty for known attack behaviour and anomalies, and canaries for the touch nothing legitimate ever makes. For the canary layer, the details that decide whether it works are the management-versus-data-event split, the EventBridge rule state for read-only calls, and coverage that keeps pace with every account you add.
Talk to the Tracebit team to see how this applies to your environment.
More on tracebit.comDetect breaches across your AWS environmentFrequently asked questions about detecting an attacker in AWS
- What's the difference between management events and data events in CloudTrail, and why does it matter for a canary?
- Management events cover control-plane operations — IAM changes, sts:GetCallerIdentity, bucket creation — and are logged by default. Data events cover high-volume data-plane operations like s3:GetObject or DynamoDB item reads, and AWS does not log these by default because of the added cost. A canary that depends on knowing someone read an object out of a decoy bucket won't fire unless S3 data events are explicitly enabled for that bucket — this is the most common reason a canary silently fails to work.
- Can a small team realistically build this themselves?
- A single working canary, yes — a competent cloud engineer can stand one up in an afternoon using a decoy resource, a CloudTrail trail, an EventBridge rule, and an SNS topic. What's harder is extending that to real coverage: hundreds of accounts, kept fresh and believable, without it becoming a full-time maintenance job.
- Does this only catch external attackers, or does it catch compromised credentials too?
- Both — the mechanism doesn't care how someone ended up with the ability to touch the decoy, whether through a stolen credential, an insider going somewhere they shouldn't, or a compromised piece of software running with more access than it needed. Anyone or anything touching a resource with no legitimate use trips the same alert.
- What happens after a canary fires — where does the alert go?
- SNS to email is the fastest version to stand up, but most teams route it further: SNS to a Lambda that posts into Slack or Teams, or directly into PagerDuty, so it reaches somewhere people actually look rather than an inbox that goes unchecked. Because a canary touch carries almost no false-positive rate, many teams route it at a higher severity than a typical detection by default.
- Does enabling S3 data events for a decoy bucket create meaningful extra cost or log volume?
- Minimal, since it only needs to be enabled for the specific decoy bucket, not the whole account's S3 usage. Scoping data-event logging to the canary resource avoids the broader cost concern of turning on data events account-wide, while still catching the one interaction that matters: someone reading the decoy.
- Is GuardDuty enough to detect an attacker in AWS?
- GuardDuty is the right starting point and catches a good share of known behaviour, such as instance credentials used outside AWS or calls from Tor. Its anomaly findings depend on a learned baseline, and many enumeration findings default to low severity, so a careful attacker using valid credentials can sit below the level anyone reviews. Pair it with direct CloudTrail detections for logging tampering and with canaries, which fire on a single touch.
- What is usually the first sign of an attacker in an AWS account?
- Often an identity probe: sts:GetCallerIdentity from a new IP address or user agent, followed by IAM and resource enumeration. Those calls are individually common, so they are most useful in sequence. A canary credential or role found during that enumeration turns the same stage of the attack into a single clear alert.