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.7.tar.gz (61.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

upsert_slr-1.0.7-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: upsert_slr-1.0.7.tar.gz
  • Upload date:
  • Size: 61.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.2

File hashes

Hashes for upsert_slr-1.0.7.tar.gz
Algorithm Hash digest
SHA256 8983f0c7ae8010e3fb9f7e1c2a27a02603c8beb0c3f9a92c899edce49680aa89
MD5 455aa2eaa2bbe4e51083e9acf7fc6d96
BLAKE2b-256 3195283748c2858bf04c3820518b87b0fb94b47f51bc853b52200933c646029d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: upsert_slr-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 59.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.2

File hashes

Hashes for upsert_slr-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f3c79a6cd85fcb92dd4c6c9e548874ca048b161b9b9413e916e439a8d257e1e4
MD5 27b9dc8a4cab94c546c8c4eb81b1661d
BLAKE2b-256 7a0645c7988882e328bd01e0b4887d2e99bfe0ad029c6f88e00fb4da007941b5

See more details on using hashes here.

Supported by

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