8

Introducing arn, a library for working with AWS ARNs

 3 years ago
source link: https://tech.instacart.com/introducing-arn-a-library-for-working-with-aws-arns-1c1ee17b43e2
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Introducing arn, a library for working with AWS ARNs

Image for post
Image for post

At Instacart, we run our infrastructure on AWS, so our systems often deal with AWS ARNs. We often run into cluttered code, and needed to develop a solution for simpler, safer code. That’s why today, we’re releasing arn, a Python library that simplifies parsing, validating, and working with AWS ARNs in a type-safe way.

Here’s an example of what arncan do, in this case parsing a Target Group ARN:

arn also checks that its input is indeed a valid ARN:

If you’re using type annotations, arn can help you enforce that function parameters are valid ARNs:

If you have multiple resources in your AWS infrastructure that have some attributes in common, arn can also be used to generate an ARN from another:

What resources are supported?

arn is still quite new, so it only supports the AWS resource types that we use here at Instacart, plus a few more popular ones:

  • Capacity provider
  • Container Instance
  • Cluster
  • Service
  • Task definition
  • TaskSet

ELBv2

  • Load Balancers (Application and Network)
  • ALB/NLB Listeners
  • ALB/NLB Listener Rules
  • Target Group
  • STS Assumed role
  • Access point
  • Bucket
  • Object

How do I get it?

arn supports Python 3.6 and up and has no runtime dependencies (except for a dataclasses backport if you’re on Python 3.6). To install it, simply run:

pip install arn

or add arn to your setup.pyor requirements.txt.

The docs are available at https://arn.readthedocs.io/en/latest/

I want to contribute

If you’re interested in contributing, or just want to take a look at the source, come visit us at https://github.com/instacart/arn.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK