Skip to main content

Manage AWS service-linked roles in a better way.

Project description

Upsert Service-Linked Role

AWS CDK construct to create a service-linked role (SLR) if there is no SLR for the same service, and if there is, skip the creation process.

architecture

Features

  • Create a service-linked role. If it is already created in the same AWS account, just skip the creation.
  • Standalone CFn template since no CDK assets are used. We use inline code for the Lambda function.
  • Sleep some time after role creation to wait for IAM propagation.

Usage

npm install upsert-slr
import { ServiceLinkedRole } from 'upsert-slr';

new ServiceLinkedRole(this, 'ElasticsearchSlr', {
    awsServiceName: 'es.amazonaws.com',
    description: 'Service linked role for Elasticsearch',
});

Why do we need this?

CloudFormation also supports a service-linked role (doc). Why do we need this?

Because the resource behaves strangely when there is already a role with the same name. All we need is to simply create a role, and skip it if it already exists. Such behavior as upsert is achieved by this construct, upsert-slr.

Also, even if CFn successfully creates a role, resources that depend on the role sometimes fail to be created because there is sometimes a delay before the role is actually available. See this stack overflow for more details.

To avoid the IAM propagation delay, this construct also waits for some time after a role is created.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

upsert_slr-1.0.6.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

upsert_slr-1.0.6-py3-none-any.whl (53.1 kB view details)

Uploaded Python 3

File details

Details for the file upsert_slr-1.0.6.tar.gz.

File metadata

  • Download URL: upsert_slr-1.0.6.tar.gz
  • Upload date:
  • Size: 54.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for upsert_slr-1.0.6.tar.gz
Algorithm Hash digest
SHA256 b4d37030a4275a9bb438c3349161122e050c5996567f6b4a771f64aefe43d55e
MD5 2f7c876a2995cd76525e57cdb1b92a3c
BLAKE2b-256 c379f42607446f44ce17595f10f839c569204fdb137b18f04a031cacf367d8c2

See more details on using hashes here.

File details

Details for the file upsert_slr-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: upsert_slr-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for upsert_slr-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a4566482d78123369e845d2ab14a0b988a8a542ba1ab31c0053a74b273366787
MD5 b1edf6dbc1664e35e2b41d2ca8116ed4
BLAKE2b-256 58cca54f0adad391e050cca19517f41f2a55385774666c68bdfb7c3538e4df17

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page