AWS Access Key Regex Pattern
Matches AWS access key IDs that always start with AKIA (long-term) or ASIA (temporary STS) followed by 16 uppercase alphanumeric characters.
Live Regex Tester
Pattern Breakdown
Code Examples
JavaScript
const regex = /(?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16}/;
const test = "AKIAIOSFODNN7EXAMPLE";
console.log(regex.test(test)); // true
// Extract matches
const matches = test.match(regex);
console.log(matches);Python
import re
pattern = r'(?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16}'
test = "AKIAIOSFODNN7EXAMPLE"
match = re.search(pattern, test)
print(match) # Found!Go
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`(?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16}`)
fmt.Println(re.MatchString("AKIAIOSFODNN7EXAMPLE")) // true
}Common Use Cases
Match Examples
| Input | Result |
|---|---|
| AKIAIOSFODNN7EXAMPLE | Match |
| BKIAIOSFODNN7EXAMPLE | No Match |
About the AWS Access Key Regex
Matches AWS access key IDs that always start with AKIA (long-term) or ASIA (temporary STS) followed by 16 uppercase alphanumeric characters.
Regular expressions (regex) are powerful pattern matching tools used across virtually all programming languages. The aws access key pattern is classified as intermediate difficulty in the security & auth category. It works in all major programming languages.
When using this regex, always consider edge cases and test thoroughly with real-world data. Use the interactive tester above to validate the pattern against your specific inputs before deploying to production.
More Security & Auth Patterns
Need More Regex Patterns?
Browse our complete library of 100+ regex patterns with interactive testers.
Frequently Asked Questions
What is the AWS Access Key regex pattern?
Matches AWS access key IDs that always start with AKIA (long-term) or ASIA (temporary STS) followed by 16 uppercase alphanumeric characters.
How do I use the AWS Access Key regex?
Use the pattern /(?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16}/ in your code. In JavaScript: new RegExp('(?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16}', ''). Test it above with your own input.
What does this AWS Access Key regex match?
This pattern matches: "AKIAIOSFODNN7EXAMPLE". It does NOT match: "BKIAIOSFODNN7EXAMPLE". Secret detection, security scanning, compliance checks.
Is the AWS Access Key regex beginner-friendly?
This pattern is rated Intermediate. It uses some advanced features like character classes and quantifiers.
What languages support the AWS Access Key regex?
This pattern works in all major programming languages including JavaScript, Python, Java, C#, Go, Ruby, PHP, and more. Syntax may vary slightly between regex engines.
Can I modify the AWS Access Key regex for my use case?
Yes! Use the interactive tester above to modify the pattern and test with your own data. Common modifications include making it case-insensitive (add 'i' flag), matching globally (add 'g' flag), or adjusting character classes.
Related Tools
JWT Token Regex
Intermediate Security & Auth pattern
UUID (v4) Regex
Intermediate Security & Auth pattern
API Key Pattern Regex
Advanced Security & Auth pattern
Base64 Encoded String Regex
Beginner Security & Auth pattern
MD5 Hash Regex
Beginner Security & Auth pattern
SHA-256 Hash Regex
Beginner Security & Auth pattern