Use Pulumi's new import command to generate code from existing cloud resources. Learn More

InstanceProfile

Provides an IAM instance profile.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var role = new Aws.Iam.Role("role", new Aws.Iam.RoleArgs
        {
            Path = "/",
            AssumeRolePolicy = @"{
    ""Version"": ""2012-10-17"",
    ""Statement"": [
        {
            ""Action"": ""sts:AssumeRole"",
            ""Principal"": {
               ""Service"": ""ec2.amazonaws.com""
            },
            ""Effect"": ""Allow"",
            ""Sid"": """"
        }
    ]
}
",
        });
        var testProfile = new Aws.Iam.InstanceProfile("testProfile", new Aws.Iam.InstanceProfileArgs
        {
            Role = role.Name,
        });
    }

}
package main

import (
    "fmt"

    "github.com/pulumi/pulumi-aws/sdk/v3/go/aws/iam"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        role, err := iam.NewRole(ctx, "role", &iam.RoleArgs{
            Path:             pulumi.String("/"),
            AssumeRolePolicy: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "    \"Version\": \"2012-10-17\",\n", "    \"Statement\": [\n", "        {\n", "            \"Action\": \"sts:AssumeRole\",\n", "            \"Principal\": {\n", "               \"Service\": \"ec2.amazonaws.com\"\n", "            },\n", "            \"Effect\": \"Allow\",\n", "            \"Sid\": \"\"\n", "        }\n", "    ]\n", "}\n")),
        })
        if err != nil {
            return err
        }
        _, err = iam.NewInstanceProfile(ctx, "testProfile", &iam.InstanceProfileArgs{
            Role: role.Name,
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

role = aws.iam.Role("role",
    path="/",
    assume_role_policy="""{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": "sts:AssumeRole",
            "Principal": {
               "Service": "ec2.amazonaws.com"
            },
            "Effect": "Allow",
            "Sid": ""
        }
    ]
}
""")
test_profile = aws.iam.InstanceProfile("testProfile", role=role.name)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const role = new aws.iam.Role("role", {
    path: "/",
    assumeRolePolicy: `{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": "sts:AssumeRole",
            "Principal": {
               "Service": "ec2.amazonaws.com"
            },
            "Effect": "Allow",
            "Sid": ""
        }
    ]
}
`,
});
const testProfile = new aws.iam.InstanceProfile("testProfile", {role: role.name});

Create a InstanceProfile Resource

new InstanceProfile(name: string, args?: InstanceProfileArgs, opts?: CustomResourceOptions);
def InstanceProfile(resource_name: str, opts: Optional[ResourceOptions] = None, name: Optional[str] = None, name_prefix: Optional[str] = None, path: Optional[str] = None, role: Optional[str] = None)
func NewInstanceProfile(ctx *Context, name string, args *InstanceProfileArgs, opts ...ResourceOption) (*InstanceProfile, error)
public InstanceProfile(string name, InstanceProfileArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args InstanceProfileArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args InstanceProfileArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args InstanceProfileArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

InstanceProfile Resource Properties

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

Inputs

The InstanceProfile resource accepts the following input properties:

Name string

The profile’s name. If omitted, this provider will assign a random, unique name.

NamePrefix string

Creates a unique name beginning with the specified prefix. Conflicts with name.

Path string

Path in which to create the profile.

Role string | string

The role name to include in the profile.

Name string

The profile’s name. If omitted, this provider will assign a random, unique name.

NamePrefix string

Creates a unique name beginning with the specified prefix. Conflicts with name.

Path string

Path in which to create the profile.

Role string | string

The role name to include in the profile.

name string

The profile’s name. If omitted, this provider will assign a random, unique name.

namePrefix string

Creates a unique name beginning with the specified prefix. Conflicts with name.

path string

Path in which to create the profile.

role string | Role

The role name to include in the profile.

name str

The profile’s name. If omitted, this provider will assign a random, unique name.

name_prefix str

Creates a unique name beginning with the specified prefix. Conflicts with name.

path str

Path in which to create the profile.

role str | str

The role name to include in the profile.

Outputs

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

Arn string

The ARN assigned by AWS to the instance profile.

CreateDate string

The creation timestamp of the instance profile.

Id string
The provider-assigned unique ID for this managed resource.
UniqueId string

The [unique ID][1] assigned by AWS.

Arn string

The ARN assigned by AWS to the instance profile.

CreateDate string

The creation timestamp of the instance profile.

Id string
The provider-assigned unique ID for this managed resource.
UniqueId string

The [unique ID][1] assigned by AWS.

arn string

The ARN assigned by AWS to the instance profile.

createDate string

The creation timestamp of the instance profile.

id string
The provider-assigned unique ID for this managed resource.
uniqueId string

The [unique ID][1] assigned by AWS.

arn str

The ARN assigned by AWS to the instance profile.

create_date str

The creation timestamp of the instance profile.

id str
The provider-assigned unique ID for this managed resource.
unique_id str

The [unique ID][1] assigned by AWS.

Look up an Existing InstanceProfile Resource

Get an existing InstanceProfile 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?: InstanceProfileState, opts?: CustomResourceOptions): InstanceProfile
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, arn: Optional[str] = None, create_date: Optional[str] = None, name: Optional[str] = None, name_prefix: Optional[str] = None, path: Optional[str] = None, role: Optional[str] = None, unique_id: Optional[str] = None) -> InstanceProfile
func GetInstanceProfile(ctx *Context, name string, id IDInput, state *InstanceProfileState, opts ...ResourceOption) (*InstanceProfile, error)
public static InstanceProfile Get(string name, Input<string> id, InstanceProfileState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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 ARN assigned by AWS to the instance profile.

CreateDate string

The creation timestamp of the instance profile.

Name string

The profile’s name. If omitted, this provider will assign a random, unique name.

NamePrefix string

Creates a unique name beginning with the specified prefix. Conflicts with name.

Path string

Path in which to create the profile.

Role string | string

The role name to include in the profile.

UniqueId string

The [unique ID][1] assigned by AWS.

Arn string

The ARN assigned by AWS to the instance profile.

CreateDate string

The creation timestamp of the instance profile.

Name string

The profile’s name. If omitted, this provider will assign a random, unique name.

NamePrefix string

Creates a unique name beginning with the specified prefix. Conflicts with name.

Path string

Path in which to create the profile.

Role string | string

The role name to include in the profile.

UniqueId string

The [unique ID][1] assigned by AWS.

arn string

The ARN assigned by AWS to the instance profile.

createDate string

The creation timestamp of the instance profile.

name string

The profile’s name. If omitted, this provider will assign a random, unique name.

namePrefix string

Creates a unique name beginning with the specified prefix. Conflicts with name.

path string

Path in which to create the profile.

role string | Role

The role name to include in the profile.

uniqueId string

The [unique ID][1] assigned by AWS.

arn str

The ARN assigned by AWS to the instance profile.

create_date str

The creation timestamp of the instance profile.

name str

The profile’s name. If omitted, this provider will assign a random, unique name.

name_prefix str

Creates a unique name beginning with the specified prefix. Conflicts with name.

path str

Path in which to create the profile.

role str | str

The role name to include in the profile.

unique_id str

The [unique ID][1] assigned by AWS.

Import

Instance Profiles can be imported using the name, e.g.

 $ pulumi import aws:iam/instanceProfile:InstanceProfile test_profile app-instance-profile-1

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.