AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.iam.getInstanceProfiles
Explore with Pulumi AI
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",
});
import pulumi
import pulumi_aws as aws
example = aws.iam.get_instance_profiles(role_name="an_example_iam_role_name")
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
	})
}
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",
    });
});
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());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:iam:getInstanceProfiles
      arguments:
        roleName: an_example_iam_role_name
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>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]func GetInstanceProfiles(ctx *Context, args *GetInstanceProfilesArgs, opts ...InvokeOption) (*GetInstanceProfilesResult, error)
func GetInstanceProfilesOutput(ctx *Context, args *GetInstanceProfilesOutputArgs, opts ...InvokeOption) GetInstanceProfilesResultOutput> 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)
}public static CompletableFuture<GetInstanceProfilesResult> getInstanceProfiles(GetInstanceProfilesArgs args, InvokeOptions options)
public static Output<GetInstanceProfilesResult> getInstanceProfiles(GetInstanceProfilesArgs args, InvokeOptions options)
fn::invoke:
  function: aws:iam/getInstanceProfiles:getInstanceProfiles
  arguments:
    # arguments dictionaryThe following arguments are supported:
- RoleName string
- IAM role name.
- RoleName string
- IAM role name.
- roleName String
- IAM role name.
- roleName string
- IAM role name.
- role_name str
- IAM role name.
- roleName String
- IAM role name.
getInstanceProfiles Result
The following output properties are available:
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.