AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.9.1 published on Tuesday, Jun 21, 2022 by Pulumi

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/v5/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		role, err := iam.NewRole(ctx, "role", &iam.RoleArgs{
			Path:             pulumi.String("/"),
			AssumeRolePolicy: pulumi.Any(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
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var role = new Role("role", RoleArgs.builder()        
            .path("/")
            .assumeRolePolicy("""
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": "sts:AssumeRole",
            "Principal": {
               "Service": "ec2.amazonaws.com"
            },
            "Effect": "Allow",
            "Sid": ""
        }
    ]
}
            """)
            .build());

        var testProfile = new InstanceProfile("testProfile", InstanceProfileArgs.builder()        
            .role(role.name())
            .build());

    }
}
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});
resources:
  testProfile:
    type: aws:iam:InstanceProfile
    properties:
      role: ${role.name}
  role:
    type: aws:iam:Role
    properties:
      path: /
      assumeRolePolicy: |
        {
            "Version": "2012-10-17",
            "Statement": [
                {
                    "Action": "sts:AssumeRole",
                    "Principal": {
                       "Service": "ec2.amazonaws.com"
                    },
                    "Effect": "Allow",
                    "Sid": ""
                }
            ]
        }        

Create a InstanceProfile Resource

new InstanceProfile(name: string, args?: InstanceProfileArgs, opts?: CustomResourceOptions);
@overload
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,
                    tags: Optional[Mapping[str, str]] = None)
@overload
def InstanceProfile(resource_name: str,
                    args: Optional[InstanceProfileArgs] = None,
                    opts: Optional[ResourceOptions] = None)
func NewInstanceProfile(ctx *Context, name string, args *InstanceProfileArgs, opts ...ResourceOption) (*InstanceProfile, error)
public InstanceProfile(string name, InstanceProfileArgs? args = null, CustomResourceOptions? opts = null)
public InstanceProfile(String name, InstanceProfileArgs args)
public InstanceProfile(String name, InstanceProfileArgs args, CustomResourceOptions options)
type: aws:iam:InstanceProfile
properties: # The arguments to resource properties.
options: # 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.
resource_name str
The unique name of the resource.
args InstanceProfileArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control 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.
name String
The unique name of the resource.
args InstanceProfileArgs
The arguments to resource properties.
options 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 Architecture and Concepts docs.

Inputs

The InstanceProfile resource accepts the following input properties:

Name string

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

NamePrefix string

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

Path string

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

Role string | string

Name of the role to add to the profile.

Tags Dictionary<string, string>

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Name string

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

NamePrefix string

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

Path string

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

Role string | string

Name of the role to add to the profile.

Tags map[string]string

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

name String

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

namePrefix String

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

path String

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

role String | String

Name of the role to add to the profile.

tags Map<String,String>

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

name string

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

namePrefix string

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

path string

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

role string | Role

Name of the role to add to the profile.

tags {[key: string]: string}

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

name str

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

name_prefix str

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

path str

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

role str | str

Name of the role to add to the profile.

tags Mapping[str, str]

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

name String

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

namePrefix String

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

path String

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

role String |

Name of the role to add to the profile.

tags Map<String>

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

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

Arn string

ARN assigned by AWS to the instance profile.

CreateDate string

Creation timestamp of the instance profile.

Id string

The provider-assigned unique ID for this managed resource.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider .

UniqueId string

[Unique ID][1] assigned by AWS.

Arn string

ARN assigned by AWS to the instance profile.

CreateDate string

Creation timestamp of the instance profile.

Id string

The provider-assigned unique ID for this managed resource.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider .

UniqueId string

[Unique ID][1] assigned by AWS.

arn String

ARN assigned by AWS to the instance profile.

createDate String

Creation timestamp of the instance profile.

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider .

uniqueId String

[Unique ID][1] assigned by AWS.

arn string

ARN assigned by AWS to the instance profile.

createDate string

Creation timestamp of the instance profile.

id string

The provider-assigned unique ID for this managed resource.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider .

uniqueId string

[Unique ID][1] assigned by AWS.

arn str

ARN assigned by AWS to the instance profile.

create_date str

Creation timestamp of the instance profile.

id str

The provider-assigned unique ID for this managed resource.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider .

unique_id str

[Unique ID][1] assigned by AWS.

arn String

ARN assigned by AWS to the instance profile.

createDate String

Creation timestamp of the instance profile.

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider .

uniqueId String

[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,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, 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)
public static InstanceProfile get(String name, Output<String> id, InstanceProfileState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
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

ARN assigned by AWS to the instance profile.

CreateDate string

Creation timestamp of the instance profile.

Name string

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

NamePrefix string

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

Path string

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

Role string | string

Name of the role to add to the profile.

Tags Dictionary<string, string>

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider .

UniqueId string

[Unique ID][1] assigned by AWS.

Arn string

ARN assigned by AWS to the instance profile.

CreateDate string

Creation timestamp of the instance profile.

Name string

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

NamePrefix string

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

Path string

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

Role string | string

Name of the role to add to the profile.

Tags map[string]string

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider .

UniqueId string

[Unique ID][1] assigned by AWS.

arn String

ARN assigned by AWS to the instance profile.

createDate String

Creation timestamp of the instance profile.

name String

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

namePrefix String

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

path String

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

role String | String

Name of the role to add to the profile.

tags Map<String,String>

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider .

uniqueId String

[Unique ID][1] assigned by AWS.

arn string

ARN assigned by AWS to the instance profile.

createDate string

Creation timestamp of the instance profile.

name string

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

namePrefix string

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

path string

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

role string | Role

Name of the role to add to the profile.

tags {[key: string]: string}

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider .

uniqueId string

[Unique ID][1] assigned by AWS.

arn str

ARN assigned by AWS to the instance profile.

create_date str

Creation timestamp of the instance profile.

name str

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

name_prefix str

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

path str

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

role str | str

Name of the role to add to the profile.

tags Mapping[str, str]

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider .

unique_id str

[Unique ID][1] assigned by AWS.

arn String

ARN assigned by AWS to the instance profile.

createDate String

Creation timestamp of the instance profile.

name String

Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _, +, =, ,, ., @, -. Spaces are not allowed.

namePrefix String

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

path String

Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.

role String |

Name of the role to add to the profile.

tags Map<String>

Map of resource tags for the IAM Instance Profile. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider .

uniqueId String

[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.