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.
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.
Metadata
Release files for upsert-slr 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| upsert_slr-1.0.7.tar.gz | 61.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| upsert_slr-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 120.6 kB
Release files / upsert_slr-1.0.7.tar.gz
| Download URL | upsert_slr-1.0.7.tar.gz |
|---|---|
| Size | 61.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8983f0c7ae8010e3fb9f7e1c2a27a02603c8beb0c3f9a92c899edce49680aa89
|
|
BLAKE2b-256 checksum How to use checksums |
3195283748c2858bf04c3820518b87b0fb94b47f51bc853b52200933c646029d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.2
|
Release files / upsert_slr-1.0.7-py3-none-any.whl
| Download URL | upsert_slr-1.0.7-py3-none-any.whl |
|---|---|
| Size | 59.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3c79a6cd85fcb92dd4c6c9e548874ca048b161b9b9413e916e439a8d257e1e4
|
|
BLAKE2b-256 checksum How to use checksums |
7a0645c7988882e328bd01e0b4887d2e99bfe0ad029c6f88e00fb4da007941b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.2
|