Registry / aws / aws-arn-parser

aws-arn-parser

JSON →
library1.0.1jsnpmunverified

The `aws-arn-parser` package (version 1.0.1) offers a basic utility for parsing Amazon Resource Name (ARN) strings into a structured JavaScript object. It extracts common ARN components such as service, region, account ID, and resource identifier. The project's initial README explicitly stated it was in "early days," indicating a lack of robust validation and potential for future structural changes. It is a simple, dependency-free parser primarily for Node.js environments. The package under this specific name appears to be effectively unmaintained or abandoned, with no discernible release cadence. Developers are advised to consider actively maintained and more robust alternatives, such as `@aws-sdk/util-arn-parser` from the official AWS SDK, or potentially the re-scoped `@sandfox/arn` by the same author, which provides TypeScript support and a revised output structure.

npm install aws-arn-parser
INSTALL
IMPORT
SIG · AWS-ARN-PARSER
A
aws-arn-parser
awsjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
const parser = require('aws-arn-parser');
import parser from 'aws-arn-parser';
This package primarily supports CommonJS `require()` syntax. Direct ESM `import` will fail without a transpiler or ESM wrapper.

This quickstart demonstrates how to use the `aws-arn-parser` package to parse two different types of AWS ARN strings into their constituent parts, printing the resulting object.

const parser = require('aws-arn-parser'); // Example IAM Server Certificate ARN const myAwsString = "arn:aws:iam::123456789012:server-certificate/division_abc/subdivision_xyz/ProdServerCert"; const arn = parser(myAwsString); console.log(arn); /* Expected output for v1.0.1: { arn: 'arn', aws: 'aws', service: 'iam', region: '', namespace: '123456789012', relativeId: 'server-certificate/division_abc/subdivision_xyz/ProdServerCert' } */ // Example S3 Bucket ARN with no region/account const s3ArnString = "arn:aws:s3:::my_bucket/path/to/object"; const s3Arn = parser(s3ArnString); console.log(s3Arn); /* Expected output for v1.0.1: { arn: 'arn', aws: 'aws', service: 's3', region: '', namespace: '', relativeId: 'my_bucket/path/to/object' } */
Debug
Known issues
deprecatedThe `aws-arn-parser` package (specifically version 1.0.1 and likely all versions under this name) is effectively abandoned. Its author may have transitioned to `@sandfox/arn`, but this specific package is no longer actively maintained. Users should migrate to actively supported alternatives.
fix
Migrate to a maintained ARN parser such as `@aws-sdk/util-arn-parser` from the official AWS SDK v3, or `@sandfox/arn` if its API matches your needs.
affects: >=1.0.0
gotchaThis parser does not perform any validation on the input ARN string. It will attempt to parse any string provided, potentially leading to incorrect or unexpected output for malformed ARNs without throwing an error.
fix
Implement custom validation logic before passing strings to the parser, or use a more robust ARN parsing library that includes validation.
affects: >=1.0.0
breakingThe output object structure of `aws-arn-parser` (v1.0.x) differs significantly from newer or alternative ARN parsers (e.g., `@sandfox/arn` or `@aws-sdk/util-arn-parser`). Specifically, it uses fields like `namespace` and `relativeId` instead of `accountID` and `resource` or `resourcePart`.
fix
Be aware of the specific output structure and adapt your code accordingly. If migrating to a newer parser, expect to update how you access ARN components.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: parser is not a function
Attempting to import `aws-arn-parser` as a named export or using ESM `import` syntax in a CommonJS environment without a transpiler, where the package only exports a default function via `module.exports`.
fix
Ensure you are using the correct CommonJS `require` syntax for a default function export: `const parser = require('aws-arn-parser');`
ARN parsing yields unexpected output fields (e.g., 'namespace' instead of 'accountID')
You are using `aws-arn-parser` (an older package) but expecting the output structure from a different, newer ARN parser (e.g., `@sandfox/arn` or `@aws-sdk/util-arn-parser`).
fix
Refer to the `aws-arn-parser` v1.0.1 documentation for its specific output format. If you need the newer structure, migrate to the corresponding package.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
1
Resources
aws-arn-parser — npm install aws-arn-parser · libregistry