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

aws.iam.getInstanceProfile

Explore with Pulumi AI

AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi

This data source can be used to fetch information about a specific IAM instance profile. 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.getInstanceProfile({
    name: "an_example_instance_profile_name",
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.iam.get_instance_profile(name="an_example_instance_profile_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.LookupInstanceProfile(ctx, &iam.LookupInstanceProfileArgs{
			Name: "an_example_instance_profile_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.GetInstanceProfile.Invoke(new()
    {
        Name = "an_example_instance_profile_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.GetInstanceProfileArgs;
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.getInstanceProfile(GetInstanceProfileArgs.builder()
            .name("an_example_instance_profile_name")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:iam:getInstanceProfile
      arguments:
        name: an_example_instance_profile_name
Copy

Using getInstanceProfile

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 getInstanceProfile(args: GetInstanceProfileArgs, opts?: InvokeOptions): Promise<GetInstanceProfileResult>
function getInstanceProfileOutput(args: GetInstanceProfileOutputArgs, opts?: InvokeOptions): Output<GetInstanceProfileResult>
Copy
def get_instance_profile(name: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetInstanceProfileResult
def get_instance_profile_output(name: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetInstanceProfileResult]
Copy
func LookupInstanceProfile(ctx *Context, args *LookupInstanceProfileArgs, opts ...InvokeOption) (*LookupInstanceProfileResult, error)
func LookupInstanceProfileOutput(ctx *Context, args *LookupInstanceProfileOutputArgs, opts ...InvokeOption) LookupInstanceProfileResultOutput
Copy

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

public static class GetInstanceProfile 
{
    public static Task<GetInstanceProfileResult> InvokeAsync(GetInstanceProfileArgs args, InvokeOptions? opts = null)
    public static Output<GetInstanceProfileResult> Invoke(GetInstanceProfileInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetInstanceProfileResult> getInstanceProfile(GetInstanceProfileArgs args, InvokeOptions options)
public static Output<GetInstanceProfileResult> getInstanceProfile(GetInstanceProfileArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:iam/getInstanceProfile:getInstanceProfile
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Friendly IAM instance profile name to match.
Name This property is required. string
Friendly IAM instance profile name to match.
name This property is required. String
Friendly IAM instance profile name to match.
name This property is required. string
Friendly IAM instance profile name to match.
name This property is required. str
Friendly IAM instance profile name to match.
name This property is required. String
Friendly IAM instance profile name to match.

getInstanceProfile Result

The following output properties are available:

Arn string
ARN.
CreateDate string
String representation of the date the instance profile was created.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Path string
Path to the instance profile.
RoleArn string
Role ARN associated with this instance profile.
RoleId string
Role ID associated with this instance profile.
RoleName string
Role name associated with this instance profile.
Arn string
ARN.
CreateDate string
String representation of the date the instance profile was created.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Path string
Path to the instance profile.
RoleArn string
Role ARN associated with this instance profile.
RoleId string
Role ID associated with this instance profile.
RoleName string
Role name associated with this instance profile.
arn String
ARN.
createDate String
String representation of the date the instance profile was created.
id String
The provider-assigned unique ID for this managed resource.
name String
path String
Path to the instance profile.
roleArn String
Role ARN associated with this instance profile.
roleId String
Role ID associated with this instance profile.
roleName String
Role name associated with this instance profile.
arn string
ARN.
createDate string
String representation of the date the instance profile was created.
id string
The provider-assigned unique ID for this managed resource.
name string
path string
Path to the instance profile.
roleArn string
Role ARN associated with this instance profile.
roleId string
Role ID associated with this instance profile.
roleName string
Role name associated with this instance profile.
arn str
ARN.
create_date str
String representation of the date the instance profile was created.
id str
The provider-assigned unique ID for this managed resource.
name str
path str
Path to the instance profile.
role_arn str
Role ARN associated with this instance profile.
role_id str
Role ID associated with this instance profile.
role_name str
Role name associated with this instance profile.
arn String
ARN.
createDate String
String representation of the date the instance profile was created.
id String
The provider-assigned unique ID for this managed resource.
name String
path String
Path to the instance profile.
roleArn String
Role ARN associated with this instance profile.
roleId String
Role ID associated with this instance profile.
roleName String
Role name associated with this instance profile.

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.75.0 published on Wednesday, Apr 2, 2025 by Pulumi