AWS ARN Parser

1.0.1 · abandoned · verified Sun Apr 19

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.

Common errors

Warnings

Install

Imports

Quickstart

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'
}
*/

view raw JSON →