npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

aws-ram-resource-share-acceptor-cdk-construct

v1.1.1

Published

An AWS CDK construct designed to automate acceptance of a resource shared via AWS RAM from a different account.

Readme

An AWS CDK construct designed to automate acceptance of a resource shared via AWS RAM from a different account.

It is compiled with JSII and is intended to be usable in Go, Java, Javascript (Node), .NET, and Python.

how it works

Suppose you want to use AWS Resource Access Manager to share a resource between accounts, and you want to manage this with AWS CDK.

There are two halves to sharing your resource with another account:

  1. in the resource owner account ("sender account"), create a CfnResourceShare construct to initiate sharing;
  2. in the receiver account, accept the resource share. But how? There is no equivalent CDK construct!

This package implements a generic way to accept resource shares through AWS Resource Access Manager in your CDK, then to reference that resource's ARN in the rest of your CDK code. This library supports all shareable AWS resources.

The key construct is RamSharedResource. It represents a single shared resource. Configure this construct with your resource's identifying information (resource type, owner account ID, etc). Here's how it is designed to behave:

Case A: If RamSharedResource finds this resource already accepted, then it will not do anything further but simply provide the resource ARN to your stack.

Case B: If instead it does not find the resource but finds an invitation for it, then it will accept the invitation. Now we are in Case A.

Case C: If RamSharedResource does not find the resource nor an invitation for it, then it will fail creation or update.

By default, RamSharedResource re-looks for the given resource on all stack updates, even if its own inputs haven't changed. This mode helps surface problems earlier and closer to the root cause.

usage example

In this example, account 000111222333 has an API Gateway private API, creates a custom domain name for it, and wants to share this custom domain name with account 123456789012.

in resource owner account (000111222333)

import * as apigw from "aws-cdk-lib/aws-apigateway";
import * as ram from "aws-cdk-lib/aws-ram";

const pcd = new apigw.CfnDomainNameV2(...); // resource you are sharing

new ram.CfnResourceShare(this, "pcd-public-share", {
  name: "ApiGwPrivateDomainName",
  principals: ["123456789012"],
  resourceArns: [pcd.attrDomainNameArn],
});

Once this is deployed, Resource Access Manager will extend an invitation to account 123456789012 to have access to the custom domain name. That account will have 12 hours to accept.

in resource receiver account (123456789012)

import { RamSharedResource } from "aws-ram-resource-share-acceptor-cdk-construct";

const pcd = new RamSharedResource(this, "ram-shared-pcd", {
  resourceType: "apigateway:Domainnames",
  senderAccountId: "000111222333",
  shareName: "ApiGwPrivateDomainName"
};

new apigw.CfnDomainNameAccessAssociation(this, "dnaa", {
  domainNameArn: pcd.resourceArn, // reference the received resource
  ...
});

The three arguments to RamSharedResource are intended to narrow down which shared resource you intend to accept. All three are required.

  • resourceType is documented at AWS shareable resources;
  • shareName must match the name attribute of ram.CfnResourceShare on the sender/owner side.

Once this is deployed, a Lambda function will run, look for the invitation matching the filters, and accept it.

building with JSII

nix-shell -p dotnet-sdk_10 -p python313 -p python313Packages.cffi -p go --run "npm run package"