1. Packages
  2. AWS
  3. API Docs
  4. iam
  5. ServiceLinkedRole
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.iam.ServiceLinkedRole

Explore with Pulumi AI

Provides an IAM service-linked role.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const elasticbeanstalk = new aws.iam.ServiceLinkedRole("elasticbeanstalk", {awsServiceName: "elasticbeanstalk.amazonaws.com"});
Copy
import pulumi
import pulumi_aws as aws

elasticbeanstalk = aws.iam.ServiceLinkedRole("elasticbeanstalk", aws_service_name="elasticbeanstalk.amazonaws.com")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iam.NewServiceLinkedRole(ctx, "elasticbeanstalk", &iam.ServiceLinkedRoleArgs{
			AwsServiceName: pulumi.String("elasticbeanstalk.amazonaws.com"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var elasticbeanstalk = new Aws.Iam.ServiceLinkedRole("elasticbeanstalk", new()
    {
        AwsServiceName = "elasticbeanstalk.amazonaws.com",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.ServiceLinkedRole;
import com.pulumi.aws.iam.ServiceLinkedRoleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var elasticbeanstalk = new ServiceLinkedRole("elasticbeanstalk", ServiceLinkedRoleArgs.builder()
            .awsServiceName("elasticbeanstalk.amazonaws.com")
            .build());

    }
}
Copy
resources:
  elasticbeanstalk:
    type: aws:iam:ServiceLinkedRole
    properties:
      awsServiceName: elasticbeanstalk.amazonaws.com
Copy

Create ServiceLinkedRole Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ServiceLinkedRole(name: string, args: ServiceLinkedRoleArgs, opts?: CustomResourceOptions);
@overload
def ServiceLinkedRole(resource_name: str,
                      args: ServiceLinkedRoleArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def ServiceLinkedRole(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      aws_service_name: Optional[str] = None,
                      custom_suffix: Optional[str] = None,
                      description: Optional[str] = None,
                      tags: Optional[Mapping[str, str]] = None)
func NewServiceLinkedRole(ctx *Context, name string, args ServiceLinkedRoleArgs, opts ...ResourceOption) (*ServiceLinkedRole, error)
public ServiceLinkedRole(string name, ServiceLinkedRoleArgs args, CustomResourceOptions? opts = null)
public ServiceLinkedRole(String name, ServiceLinkedRoleArgs args)
public ServiceLinkedRole(String name, ServiceLinkedRoleArgs args, CustomResourceOptions options)
type: aws:iam:ServiceLinkedRole
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ServiceLinkedRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ServiceLinkedRoleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceLinkedRoleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceLinkedRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ServiceLinkedRoleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var serviceLinkedRoleResource = new Aws.Iam.ServiceLinkedRole("serviceLinkedRoleResource", new()
{
    AwsServiceName = "string",
    CustomSuffix = "string",
    Description = "string",
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := iam.NewServiceLinkedRole(ctx, "serviceLinkedRoleResource", &iam.ServiceLinkedRoleArgs{
	AwsServiceName: pulumi.String("string"),
	CustomSuffix:   pulumi.String("string"),
	Description:    pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var serviceLinkedRoleResource = new ServiceLinkedRole("serviceLinkedRoleResource", ServiceLinkedRoleArgs.builder()
    .awsServiceName("string")
    .customSuffix("string")
    .description("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
service_linked_role_resource = aws.iam.ServiceLinkedRole("serviceLinkedRoleResource",
    aws_service_name="string",
    custom_suffix="string",
    description="string",
    tags={
        "string": "string",
    })
Copy
const serviceLinkedRoleResource = new aws.iam.ServiceLinkedRole("serviceLinkedRoleResource", {
    awsServiceName: "string",
    customSuffix: "string",
    description: "string",
    tags: {
        string: "string",
    },
});
Copy
type: aws:iam:ServiceLinkedRole
properties:
    awsServiceName: string
    customSuffix: string
    description: string
    tags:
        string: string
Copy

ServiceLinkedRole Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ServiceLinkedRole resource accepts the following input properties:

AwsServiceName
This property is required.
Changes to this property will trigger replacement.
string
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
CustomSuffix Changes to this property will trigger replacement. string
Additional string appended to the role name. Not all AWS services support custom suffixes.
Description string
The description of the role.
Tags Dictionary<string, string>
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
AwsServiceName
This property is required.
Changes to this property will trigger replacement.
string
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
CustomSuffix Changes to this property will trigger replacement. string
Additional string appended to the role name. Not all AWS services support custom suffixes.
Description string
The description of the role.
Tags map[string]string
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
awsServiceName
This property is required.
Changes to this property will trigger replacement.
String
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
customSuffix Changes to this property will trigger replacement. String
Additional string appended to the role name. Not all AWS services support custom suffixes.
description String
The description of the role.
tags Map<String,String>
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
awsServiceName
This property is required.
Changes to this property will trigger replacement.
string
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
customSuffix Changes to this property will trigger replacement. string
Additional string appended to the role name. Not all AWS services support custom suffixes.
description string
The description of the role.
tags {[key: string]: string}
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
aws_service_name
This property is required.
Changes to this property will trigger replacement.
str
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
custom_suffix Changes to this property will trigger replacement. str
Additional string appended to the role name. Not all AWS services support custom suffixes.
description str
The description of the role.
tags Mapping[str, str]
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
awsServiceName
This property is required.
Changes to this property will trigger replacement.
String
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
customSuffix Changes to this property will trigger replacement. String
Additional string appended to the role name. Not all AWS services support custom suffixes.
description String
The description of the role.
tags Map<String>
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

All input properties are implicitly available as output properties. Additionally, the ServiceLinkedRole resource produces the following output properties:

Arn string
The Amazon Resource Name (ARN) specifying the role.
CreateDate string
The creation date of the IAM role.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the role.
Path string
The path of the role.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

UniqueId string
The stable and unique string identifying the role.
Arn string
The Amazon Resource Name (ARN) specifying the role.
CreateDate string
The creation date of the IAM role.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the role.
Path string
The path of the role.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

UniqueId string
The stable and unique string identifying the role.
arn String
The Amazon Resource Name (ARN) specifying the role.
createDate String
The creation date of the IAM role.
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the role.
path String
The path of the role.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

uniqueId String
The stable and unique string identifying the role.
arn string
The Amazon Resource Name (ARN) specifying the role.
createDate string
The creation date of the IAM role.
id string
The provider-assigned unique ID for this managed resource.
name string
The name of the role.
path string
The path of the role.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

uniqueId string
The stable and unique string identifying the role.
arn str
The Amazon Resource Name (ARN) specifying the role.
create_date str
The creation date of the IAM role.
id str
The provider-assigned unique ID for this managed resource.
name str
The name of the role.
path str
The path of the role.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

unique_id str
The stable and unique string identifying the role.
arn String
The Amazon Resource Name (ARN) specifying the role.
createDate String
The creation date of the IAM role.
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the role.
path String
The path of the role.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

uniqueId String
The stable and unique string identifying the role.

Look up Existing ServiceLinkedRole Resource

Get an existing ServiceLinkedRole resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ServiceLinkedRoleState, opts?: CustomResourceOptions): ServiceLinkedRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        aws_service_name: Optional[str] = None,
        create_date: Optional[str] = None,
        custom_suffix: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        path: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        unique_id: Optional[str] = None) -> ServiceLinkedRole
func GetServiceLinkedRole(ctx *Context, name string, id IDInput, state *ServiceLinkedRoleState, opts ...ResourceOption) (*ServiceLinkedRole, error)
public static ServiceLinkedRole Get(string name, Input<string> id, ServiceLinkedRoleState? state, CustomResourceOptions? opts = null)
public static ServiceLinkedRole get(String name, Output<String> id, ServiceLinkedRoleState state, CustomResourceOptions options)
resources:  _:    type: aws:iam:ServiceLinkedRole    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string
The Amazon Resource Name (ARN) specifying the role.
AwsServiceName Changes to this property will trigger replacement. string
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
CreateDate string
The creation date of the IAM role.
CustomSuffix Changes to this property will trigger replacement. string
Additional string appended to the role name. Not all AWS services support custom suffixes.
Description string
The description of the role.
Name string
The name of the role.
Path string
The path of the role.
Tags Dictionary<string, string>
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

UniqueId string
The stable and unique string identifying the role.
Arn string
The Amazon Resource Name (ARN) specifying the role.
AwsServiceName Changes to this property will trigger replacement. string
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
CreateDate string
The creation date of the IAM role.
CustomSuffix Changes to this property will trigger replacement. string
Additional string appended to the role name. Not all AWS services support custom suffixes.
Description string
The description of the role.
Name string
The name of the role.
Path string
The path of the role.
Tags map[string]string
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

UniqueId string
The stable and unique string identifying the role.
arn String
The Amazon Resource Name (ARN) specifying the role.
awsServiceName Changes to this property will trigger replacement. String
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
createDate String
The creation date of the IAM role.
customSuffix Changes to this property will trigger replacement. String
Additional string appended to the role name. Not all AWS services support custom suffixes.
description String
The description of the role.
name String
The name of the role.
path String
The path of the role.
tags Map<String,String>
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

uniqueId String
The stable and unique string identifying the role.
arn string
The Amazon Resource Name (ARN) specifying the role.
awsServiceName Changes to this property will trigger replacement. string
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
createDate string
The creation date of the IAM role.
customSuffix Changes to this property will trigger replacement. string
Additional string appended to the role name. Not all AWS services support custom suffixes.
description string
The description of the role.
name string
The name of the role.
path string
The path of the role.
tags {[key: string]: string}
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

uniqueId string
The stable and unique string identifying the role.
arn str
The Amazon Resource Name (ARN) specifying the role.
aws_service_name Changes to this property will trigger replacement. str
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
create_date str
The creation date of the IAM role.
custom_suffix Changes to this property will trigger replacement. str
Additional string appended to the role name. Not all AWS services support custom suffixes.
description str
The description of the role.
name str
The name of the role.
path str
The path of the role.
tags Mapping[str, str]
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

unique_id str
The stable and unique string identifying the role.
arn String
The Amazon Resource Name (ARN) specifying the role.
awsServiceName Changes to this property will trigger replacement. String
The AWS service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: elasticbeanstalk.amazonaws.com. To find the full list of services that support service-linked roles, check the docs.
createDate String
The creation date of the IAM role.
customSuffix Changes to this property will trigger replacement. String
Additional string appended to the role name. Not all AWS services support custom suffixes.
description String
The description of the role.
name String
The name of the role.
path String
The path of the role.
tags Map<String>
Key-value mapping of tags for the IAM role. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

uniqueId String
The stable and unique string identifying the role.

Import

Using pulumi import, import IAM service-linked roles using role ARN. For example:

$ pulumi import aws:iam/serviceLinkedRole:ServiceLinkedRole elasticbeanstalk arn:aws:iam::123456789012:role/aws-service-role/elasticbeanstalk.amazonaws.com/AWSServiceRoleForElasticBeanstalk
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.