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

aws.iam.getInstanceProfiles

Explore with Pulumi AI

AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

This data source can be used to fetch information about all IAM instance profiles under a role. By using this data source, you can reference IAM instance profile properties without having to hard code ARNs as input.

Example Usage

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

const example = aws.iam.getInstanceProfiles({
    roleName: "an_example_iam_role_name",
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.iam.get_instance_profiles(role_name="an_example_iam_role_name")
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.GetInstanceProfiles(ctx, &iam.GetInstanceProfilesArgs{
			RoleName: "an_example_iam_role_name",
		}, nil)
		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 example = Aws.Iam.GetInstanceProfiles.Invoke(new()
    {
        RoleName = "an_example_iam_role_name",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetInstanceProfilesArgs;
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) {
        final var example = IamFunctions.getInstanceProfiles(GetInstanceProfilesArgs.builder()
            .roleName("an_example_iam_role_name")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:iam:getInstanceProfiles
      arguments:
        roleName: an_example_iam_role_name
Copy

Using getInstanceProfiles

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getInstanceProfiles(args: GetInstanceProfilesArgs, opts?: InvokeOptions): Promise<GetInstanceProfilesResult>
function getInstanceProfilesOutput(args: GetInstanceProfilesOutputArgs, opts?: InvokeOptions): Output<GetInstanceProfilesResult>
Copy
def get_instance_profiles(role_name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetInstanceProfilesResult
def get_instance_profiles_output(role_name: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetInstanceProfilesResult]
Copy
func GetInstanceProfiles(ctx *Context, args *GetInstanceProfilesArgs, opts ...InvokeOption) (*GetInstanceProfilesResult, error)
func GetInstanceProfilesOutput(ctx *Context, args *GetInstanceProfilesOutputArgs, opts ...InvokeOption) GetInstanceProfilesResultOutput
Copy

> Note: This function is named GetInstanceProfiles in the Go SDK.

public static class GetInstanceProfiles 
{
    public static Task<GetInstanceProfilesResult> InvokeAsync(GetInstanceProfilesArgs args, InvokeOptions? opts = null)
    public static Output<GetInstanceProfilesResult> Invoke(GetInstanceProfilesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetInstanceProfilesResult> getInstanceProfiles(GetInstanceProfilesArgs args, InvokeOptions options)
public static Output<GetInstanceProfilesResult> getInstanceProfiles(GetInstanceProfilesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:iam/getInstanceProfiles:getInstanceProfiles
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

RoleName This property is required. string
IAM role name.
RoleName This property is required. string
IAM role name.
roleName This property is required. String
IAM role name.
roleName This property is required. string
IAM role name.
role_name This property is required. str
IAM role name.
roleName This property is required. String
IAM role name.

getInstanceProfiles Result

The following output properties are available:

Arns List<string>
Set of ARNs of instance profiles.
Id string
The provider-assigned unique ID for this managed resource.
Names List<string>
Set of IAM instance profile names.
Paths List<string>
Set of IAM instance profile paths.
RoleName string
Arns []string
Set of ARNs of instance profiles.
Id string
The provider-assigned unique ID for this managed resource.
Names []string
Set of IAM instance profile names.
Paths []string
Set of IAM instance profile paths.
RoleName string
arns List<String>
Set of ARNs of instance profiles.
id String
The provider-assigned unique ID for this managed resource.
names List<String>
Set of IAM instance profile names.
paths List<String>
Set of IAM instance profile paths.
roleName String
arns string[]
Set of ARNs of instance profiles.
id string
The provider-assigned unique ID for this managed resource.
names string[]
Set of IAM instance profile names.
paths string[]
Set of IAM instance profile paths.
roleName string
arns Sequence[str]
Set of ARNs of instance profiles.
id str
The provider-assigned unique ID for this managed resource.
names Sequence[str]
Set of IAM instance profile names.
paths Sequence[str]
Set of IAM instance profile paths.
role_name str
arns List<String>
Set of ARNs of instance profiles.
id String
The provider-assigned unique ID for this managed resource.
names List<String>
Set of IAM instance profile names.
paths List<String>
Set of IAM instance profile paths.
roleName String

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi