MORTIMERDEV LABS / AWS / ARN FREE · BETA

What does this ARN mean?
And why won’t my policy match?

Paste an Amazon Resource Name to see every part explained, the resource type it points to, and the mistakes that make IAM policies silently fail: a Region where there shouldn’t be one, a missing account, the wrong partition or a wildcard in the wrong place. Or build one, with the CDK to make it in TypeScript and Python.

Runs in your browser. Nothing is stored or sent. Use 123456789012 in place of real account IDs if you prefer.
Take the 10-question AWS basics quiz

Explain an ARN

Try:

Build an ARN

CDK (TypeScript)

CDK (Python)

In an IAM policy statement

What is an ARN?

An Amazon Resource Name is the unique address of one thing in AWS: a bucket, a Lambda function, an IAM role, a CloudWatch alarm. Names can repeat across accounts and Regions, so whenever AWS needs to point at one exact resource, it uses its ARN.

arn:aws:lambda:eu-west-2:123456789012:function:resize-images
Partition
Which AWS: aws, aws-cn (China), aws-us-gov…
Service
The service namespace, like s3, iam or lambda
Region
Where it lives; empty for global services like IAM
Account
The 12-digit account that owns it; empty for S3 buckets
Resource
The type and name, in a format each service defines

Where you’ll use them

  • IAM policies: the Resource element lists the ARNs a statement applies to, and wildcards let one ARN cover many resources.
  • Connecting services: event rules, subscriptions, triggers and cross-account access all take the ARN of the thing on the other end.
  • CDK and CloudFormation: attributes like bucket.bucketArn or Fn::GetAtt give you ARNs, so you rarely need to type one.
  • Finding one: most console pages show an ARN with a copy button, and aws sts get-caller-identity shows the ARN you’re signed in as.

Easy to confuse

An ARN isn’t a URL (an SQS queue URL starts with https://), a resource ID (like i-0abc123) or a display name, although it often contains one of them.

TEST YOURSELF

How well do you know AWS basics?

Ten questions on ARNs, IAM, Regions, S3, Lambda and CloudWatch, with an explanation and a link to the reference after each one. Three are “which ARN is right?” questions checked by the same engine as the explainer.

AWS REFERENCE

ARNs and AWS basics, in plain English.

ARNs

ARN formatarn:partition:service:region:account-id:resource. Six parts separated by colons.

The resource part varies by service: just an ID (an SNS topic name), type/ID (role/deploy) or type:ID (function:resize). It can contain more colons and slashes, for example a Lambda alias (function:resize:live) or an S3 object key.

Partitionsaws for the commercial Regions; aws-cn for China; aws-us-gov for GovCloud; aws-eusc for the European Sovereign Cloud.

A partition is a separate group of Regions with its own accounts and IAM. Hard-coding arn:aws: breaks in other partitions. In CloudFormation use ${AWS::Partition}; in CDK use Aws.PARTITION or Stack.of(this).formatArn(), which fills it in for you.

ARNs without a Region or accountGlobal services leave the Region empty (IAM, CloudFront). S3 buckets and Route 53 zones leave out the account too.

That’s why IAM role ARNs have two colons together (arn:aws:iam::123456789012:role/…) and S3 bucket ARNs have three (arn:aws:s3:::my-bucket). A policy that adds a Region or account to these won’t match anything.

Account IDsAlways 12 digits, including leading zeros. AWS managed IAM policies use aws instead.

Account IDs aren’t secrets: they appear in ARNs, logs and shared resources. They still help attackers target you, so use 123456789012 in docs and screenshots. AWS’s own examples also use 111122223333 and 444455556666.

Wildcards in ARNs* matches any characters (including slashes), ? matches one. Allowed in Resource, not in Principal.

Wildcards can go in the Region, account or resource name (arn:aws:s3:::my-bucket/reports/*), but not in the partition or resource type. In identity-based policies an incomplete ARN is padded with wildcards: arn:aws:sqs means arn:aws:sqs:*:*:*.

IAM

The root userThe email address that created the account. Turn on MFA and don’t use it for everyday work.

Root can do everything, including closing the account, and can’t be limited by IAM policies. Use it only for the few tasks that need it, and work through IAM Identity Center users or roles instead.

Users, roles and policiesPolicies say what’s allowed. Users have long-lived credentials; roles hand out temporary ones when assumed.

Prefer roles everywhere: Lambda and ECS get credentials from their execution role, GitHub Actions can assume a role through OIDC, and people sign in through IAM Identity Center. Access keys on users are the most common way AWS accounts leak.

Allow, Deny and the defaultEverything is denied unless something allows it, and an explicit Deny always wins over an Allow.

AWS checks every applicable policy: identity policies, resource policies (like bucket policies), permission boundaries, session policies and organisation SCPs. One matching Deny anywhere ends it. Grant least privilege: only the actions and resources needed.

AWS basics

Regions and Availability ZonesA Region (eu-west-2) is a geographic area; it contains several isolated Availability Zones (eu-west-2a, b, c).

Spread a service across Availability Zones to survive one failing; use several Regions only when you need to survive a whole Region failing or serve users far apart. Most resources live in one Region, and data stays there unless you copy it.

What costs moneyRunning time, storage, requests and data leaving AWS. Data coming in from the internet is free.

Common surprises: NAT gateways (hourly plus per GB), idle load balancers, data transfer out and between Availability Zones, CloudWatch Logs kept forever (the default), and forgotten resources in another Region. Set an AWS Budget with an alert on day one.

Shared responsibilityAWS secures the cloud (hardware, facilities, managed service internals); you secure what you put in it.

Your side includes IAM permissions, data encryption choices, network rules, patching your own servers and who can read your S3 buckets. The more managed the service (Lambda vs EC2), the less you have to patch.

Services and CDK

S3 bucketsBuckets live in one Region, but their names are shared across every account in the partition.

New buckets block public access and disable ACLs by default; keep it that way and serve public files through CloudFront. Bucket names must be 3–63 characters of lowercase letters, numbers, dots and hyphens.

LambdaRuns your code on demand. Up to 15 minutes per invocation and 128 MB to 10,240 MB of memory.

You pay per request and per millisecond of run time, scaled by memory (which also sets CPU). Its permissions come from its execution role. For longer jobs use Step Functions, ECS or Batch.

CloudWatchMetrics, logs, alarms and dashboards. Alarms are OK, ALARM or INSUFFICIENT_DATA.

Services publish metrics automatically; your code can add custom metrics and logs. Log groups keep data forever unless you set a retention period, which is a common cost leak. RUM measures real users’ browsers, and Application Signals tracks SLOs.

ARNs in CDKUse resource properties (bucket.bucketArn) or Stack.of(this).formatArn(); avoid hard-coded strings.

formatArn fills in the stack’s partition, Region and account, so the same code works in every account and partition. Pass region: "" or account: "" for ARNs that leave them out. In Python it’s Stack.of(self).format_arn(…).

Checked against AWS’s ARN rules.

The explainer follows AWS’s ARN reference and knows 48 common resource types, including which leave out the Region or account. Other services are still split and checked, just without a type-specific explanation.

Nothing leaves this page.

ARNs are explained in your browser and nothing is saved. We count anonymous page views and button use, never what you enter.