Class CfnServiceLinkedRole
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.iam.CfnServiceLinkedRole
- All Implemented Interfaces:
IInspectable,IServiceLinkedRoleRef,IEnvironmentAware,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:10:07.163Z")
@Stability(Stable)
public class CfnServiceLinkedRole
extends CfnResource
implements IInspectable, IServiceLinkedRoleRef
Creates an IAM role that is linked to a specific AWS service.
The service controls the attached policies and when the role can be deleted. This helps ensure that the service is not broken by an unexpectedly changed or deleted role, which could put your AWS resources into an unknown state. Allowing the service to control the role helps improve service stability and proper cleanup when a service and its role are no longer needed. For more information, see Using service-linked roles in the IAM User Guide .
To attach a policy to this service-linked role, you must make the request using the AWS service that depends on this role.
Example:
CfnServiceLinkedRole slr = CfnServiceLinkedRole.Builder.create(this, "ElasticSLR")
.awsServiceName("es.amazonaws.com")
.build();
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.iam.IServiceLinkedRoleRef
IServiceLinkedRoleRef.Jsii$Default, IServiceLinkedRoleRef.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnServiceLinkedRole(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnServiceLinkedRole(software.amazon.jsii.JsiiObjectRef objRef) CfnServiceLinkedRole(software.constructs.Construct scope, String id) Create a newAWS::IAM::ServiceLinkedRole.CfnServiceLinkedRole(software.constructs.Construct scope, String id, CfnServiceLinkedRoleProps props) Create a newAWS::IAM::ServiceLinkedRole. -
Method Summary
Modifier and TypeMethodDescriptionReturns the friendly name that identifies the role.The service principal for the AWS service to which this role is attached.A string that you provide, which is combined with the service-provided prefix to form the complete role name.The description of the role.A reference to a ServiceLinkedRole resource.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetAwsServiceName(String value) The service principal for the AWS service to which this role is attached.voidsetCustomSuffix(String value) A string that you provide, which is combined with the service-provided prefix to form the complete role name.voidsetDescription(String value) The description of the role.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnServiceLinkedRole
protected CfnServiceLinkedRole(software.amazon.jsii.JsiiObjectRef objRef) -
CfnServiceLinkedRole
protected CfnServiceLinkedRole(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnServiceLinkedRole
@Stability(Stable) public CfnServiceLinkedRole(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnServiceLinkedRoleProps props) Create a newAWS::IAM::ServiceLinkedRole.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnServiceLinkedRole
@Stability(Stable) public CfnServiceLinkedRole(@NotNull software.constructs.Construct scope, @NotNull String id) Create a newAWS::IAM::ServiceLinkedRole.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrRoleName
Returns the friendly name that identifies the role.For example,
AWSServiceRoleForAutoScalingorAWSServiceRoleForAutoScaling_TestSuffixif aCustomSuffixis specified. -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getServiceLinkedRoleRef
A reference to a ServiceLinkedRole resource.- Specified by:
getServiceLinkedRoleRefin interfaceIServiceLinkedRoleRef
-
getAwsServiceName
The service principal for the AWS service to which this role is attached. -
setAwsServiceName
The service principal for the AWS service to which this role is attached. -
getCustomSuffix
A string that you provide, which is combined with the service-provided prefix to form the complete role name. -
setCustomSuffix
A string that you provide, which is combined with the service-provided prefix to form the complete role name. -
getDescription
The description of the role. -
setDescription
The description of the role.
-