@unbounce/parse-aws-arn
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

parse-aws-arn.ts

Parse AWS ARNs into Objects (with TypeScript).

Install

See https://www.npmjs.com/package/@unbounce/parse-aws-arn

npm install --save @unbounce/parse-aws-arn

Usage

import parseArn from "@unbounce/parse-aws-arn"
const arn = parseArn("arn:aws:lambda:us-west-2:123456:function:magic-lambda-fn")
console.log(arn)

{ partition: 'aws',
  service: 'lambda',
  region: 'us-west-2',
  accountId: '123456',
  resource: 'function:magic-lambda-fn',
  resourceId: 'magic-lambda-fn',
  resourceType: 'function' }

Object keys match the format defined in Amazon Resource Names (ARNs). Be aware that not all arns match the scheme. The resourceId and resourceType may be undefined if we're unable to accurately guess the pattern. For example, S3 Objects have neither a resourceId or a resource type.

FAQ

Why create another AWS ARN Parser?

Because we like types.

Readme

Keywords

Package Sidebar

Install

npm i @unbounce/parse-aws-arn

Weekly Downloads

91

Version

1.2.2

License

MIT

Unpacked Size

6.45 kB

Total Files

6

Last publish

Collaborators

  • ubstevefisher
  • alukonin
  • simonmcho
  • brianpburns
  • maxcloutier
  • pabloadu
  • unbounce-npm
  • gpr47
  • tavis.rudd
  • kalupa