Skip to main content
AllDevToolsHub
Back to all patterns

AWS ARN

Web & Network

Matches the structure of an AWS Amazon Resource Name (ARN).

/^arn:(?:aws|aws-cn|aws-us-gov):[a-zA-Z0-9-]+:[a-z0-9-]*:[0-9]*:.+$/

How it works

ARN format: arn:partition:service:region:account-id:resource. Partition is aws, aws-cn, or aws-us-gov. Some services (S3, IAM) omit region or account-id, hence the *. The final segment is service-specific.

Test Cases

Should Match

  • arn:aws:s3:::my-bucket
  • arn:aws:iam::123456789012:role/MyRole
  • arn:aws-cn:lambda:cn-north-1:123456789012:function:hello

Should NOT Match

  • arn:aws:s3
  • s3://my-bucket

Quick Summary

Matches the arn:partition:service:region:account:resource shape of an AWS ARN.