1. Packages
  2. AWS
  3. API Docs
  4. iam
  5. getInstanceProfiles
AWS v6 v6.83.2 published on Thursday, Nov 20, 2025 by Pulumi
aws-v6 logo
AWS v6 v6.83.2 published on Thursday, Nov 20, 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",
    });
    
    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 dictionary

    The 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:

    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 logo
    AWS v6 v6.83.2 published on Thursday, Nov 20, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate