We recommend new projects start with resources from the AWS provider.
aws-native.iam.InstanceProfile
Explore with Pulumi AI
We recommend new projects start with resources from the AWS provider.
Creates a new instance profile. For information about instance profiles, see Using instance profiles. For information about the number of instance profiles you can create, see object quotas in the User Guide.
Example Usage
Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;
return await Deployment.RunAsync(() =>
{
var myIamInstanceProfile = new AwsNative.Iam.InstanceProfile("myIamInstanceProfile", new()
{
InstanceProfileName = "MyIamInstanceProfile",
Path = "/",
Roles = new[]
{
"MyAdminRole",
},
});
var myLaunchTemplate = new AwsNative.Ec2.LaunchTemplate("myLaunchTemplate", new()
{
LaunchTemplateName = "MyLaunchTemplate",
LaunchTemplateData = new AwsNative.Ec2.Inputs.LaunchTemplateDataArgs
{
IamInstanceProfile = new AwsNative.Ec2.Inputs.LaunchTemplateIamInstanceProfileArgs
{
Arn = myIamInstanceProfile.Arn,
},
DisableApiTermination = true,
ImageId = "ami-04d5cc9b88example",
InstanceType = "t2.micro",
KeyName = "MyKeyPair",
SecurityGroupIds = new[]
{
"sg-083cd3bfb8example",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/ec2"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myIamInstanceProfile, err := iam.NewInstanceProfile(ctx, "myIamInstanceProfile", &iam.InstanceProfileArgs{
InstanceProfileName: pulumi.String("MyIamInstanceProfile"),
Path: pulumi.String("/"),
Roles: pulumi.StringArray{
pulumi.String("MyAdminRole"),
},
})
if err != nil {
return err
}
_, err = ec2.NewLaunchTemplate(ctx, "myLaunchTemplate", &ec2.LaunchTemplateArgs{
LaunchTemplateName: pulumi.String("MyLaunchTemplate"),
LaunchTemplateData: &ec2.LaunchTemplateDataArgs{
IamInstanceProfile: &ec2.LaunchTemplateIamInstanceProfileArgs{
Arn: myIamInstanceProfile.Arn,
},
DisableApiTermination: pulumi.Bool(true),
ImageId: pulumi.String("ami-04d5cc9b88example"),
InstanceType: pulumi.String("t2.micro"),
KeyName: pulumi.String("MyKeyPair"),
SecurityGroupIds: pulumi.StringArray{
pulumi.String("sg-083cd3bfb8example"),
},
},
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_aws_native as aws_native
my_iam_instance_profile = aws_native.iam.InstanceProfile("myIamInstanceProfile",
instance_profile_name="MyIamInstanceProfile",
path="/",
roles=["MyAdminRole"])
my_launch_template = aws_native.ec2.LaunchTemplate("myLaunchTemplate",
launch_template_name="MyLaunchTemplate",
launch_template_data={
"iam_instance_profile": {
"arn": my_iam_instance_profile.arn,
},
"disable_api_termination": True,
"image_id": "ami-04d5cc9b88example",
"instance_type": "t2.micro",
"key_name": "MyKeyPair",
"security_group_ids": ["sg-083cd3bfb8example"],
})
import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";
const myIamInstanceProfile = new aws_native.iam.InstanceProfile("myIamInstanceProfile", {
instanceProfileName: "MyIamInstanceProfile",
path: "/",
roles: ["MyAdminRole"],
});
const myLaunchTemplate = new aws_native.ec2.LaunchTemplate("myLaunchTemplate", {
launchTemplateName: "MyLaunchTemplate",
launchTemplateData: {
iamInstanceProfile: {
arn: myIamInstanceProfile.arn,
},
disableApiTermination: true,
imageId: "ami-04d5cc9b88example",
instanceType: "t2.micro",
keyName: "MyKeyPair",
securityGroupIds: ["sg-083cd3bfb8example"],
},
});
Coming soon!
Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;
return await Deployment.RunAsync(() =>
{
var myIamInstanceProfile = new AwsNative.Iam.InstanceProfile("myIamInstanceProfile", new()
{
InstanceProfileName = "MyIamInstanceProfile",
Path = "/",
Roles = new[]
{
"MyAdminRole",
},
});
var myLaunchTemplate = new AwsNative.Ec2.LaunchTemplate("myLaunchTemplate", new()
{
LaunchTemplateName = "MyLaunchTemplate",
LaunchTemplateData = new AwsNative.Ec2.Inputs.LaunchTemplateDataArgs
{
IamInstanceProfile = new AwsNative.Ec2.Inputs.LaunchTemplateIamInstanceProfileArgs
{
Arn = myIamInstanceProfile.Arn,
},
DisableApiTermination = true,
ImageId = "ami-04d5cc9b88example",
InstanceType = "t2.micro",
KeyName = "MyKeyPair",
SecurityGroupIds = new[]
{
"sg-083cd3bfb8example",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/ec2"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myIamInstanceProfile, err := iam.NewInstanceProfile(ctx, "myIamInstanceProfile", &iam.InstanceProfileArgs{
InstanceProfileName: pulumi.String("MyIamInstanceProfile"),
Path: pulumi.String("/"),
Roles: pulumi.StringArray{
pulumi.String("MyAdminRole"),
},
})
if err != nil {
return err
}
_, err = ec2.NewLaunchTemplate(ctx, "myLaunchTemplate", &ec2.LaunchTemplateArgs{
LaunchTemplateName: pulumi.String("MyLaunchTemplate"),
LaunchTemplateData: &ec2.LaunchTemplateDataArgs{
IamInstanceProfile: &ec2.LaunchTemplateIamInstanceProfileArgs{
Arn: myIamInstanceProfile.Arn,
},
DisableApiTermination: pulumi.Bool(true),
ImageId: pulumi.String("ami-04d5cc9b88example"),
InstanceType: pulumi.String("t2.micro"),
KeyName: pulumi.String("MyKeyPair"),
SecurityGroupIds: pulumi.StringArray{
pulumi.String("sg-083cd3bfb8example"),
},
},
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_aws_native as aws_native
my_iam_instance_profile = aws_native.iam.InstanceProfile("myIamInstanceProfile",
instance_profile_name="MyIamInstanceProfile",
path="/",
roles=["MyAdminRole"])
my_launch_template = aws_native.ec2.LaunchTemplate("myLaunchTemplate",
launch_template_name="MyLaunchTemplate",
launch_template_data={
"iam_instance_profile": {
"arn": my_iam_instance_profile.arn,
},
"disable_api_termination": True,
"image_id": "ami-04d5cc9b88example",
"instance_type": "t2.micro",
"key_name": "MyKeyPair",
"security_group_ids": ["sg-083cd3bfb8example"],
})
import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";
const myIamInstanceProfile = new aws_native.iam.InstanceProfile("myIamInstanceProfile", {
instanceProfileName: "MyIamInstanceProfile",
path: "/",
roles: ["MyAdminRole"],
});
const myLaunchTemplate = new aws_native.ec2.LaunchTemplate("myLaunchTemplate", {
launchTemplateName: "MyLaunchTemplate",
launchTemplateData: {
iamInstanceProfile: {
arn: myIamInstanceProfile.arn,
},
disableApiTermination: true,
imageId: "ami-04d5cc9b88example",
instanceType: "t2.micro",
keyName: "MyKeyPair",
securityGroupIds: ["sg-083cd3bfb8example"],
},
});
Coming soon!
Create InstanceProfile Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new InstanceProfile(name: string, args: InstanceProfileArgs, opts?: CustomResourceOptions);
@overload
def InstanceProfile(resource_name: str,
args: InstanceProfileArgs,
opts: Optional[ResourceOptions] = None)
@overload
def InstanceProfile(resource_name: str,
opts: Optional[ResourceOptions] = None,
roles: Optional[Sequence[str]] = None,
instance_profile_name: Optional[str] = None,
path: Optional[str] = None)
func NewInstanceProfile(ctx *Context, name string, args InstanceProfileArgs, opts ...ResourceOption) (*InstanceProfile, error)
public InstanceProfile(string name, InstanceProfileArgs args, CustomResourceOptions? opts = null)
public InstanceProfile(String name, InstanceProfileArgs args)
public InstanceProfile(String name, InstanceProfileArgs args, CustomResourceOptions options)
type: aws-native:iam:InstanceProfile
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The InstanceProfile resource accepts the following input properties:
- Roles List<string>
- The name of the role to associate with the instance profile. Only one role can be assigned to an EC2 instance at a time, and all applications on the instance share the same role and permissions.
- Instance
Profile stringName - The name of the instance profile to create. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Path string
- The path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide.
This parameter is optional. If it is not included, it defaults to a slash (/).
This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
- Roles []string
- The name of the role to associate with the instance profile. Only one role can be assigned to an EC2 instance at a time, and all applications on the instance share the same role and permissions.
- Instance
Profile stringName - The name of the instance profile to create. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- Path string
- The path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide.
This parameter is optional. If it is not included, it defaults to a slash (/).
This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
- roles List<String>
- The name of the role to associate with the instance profile. Only one role can be assigned to an EC2 instance at a time, and all applications on the instance share the same role and permissions.
- instance
Profile StringName - The name of the instance profile to create. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- path String
- The path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide.
This parameter is optional. If it is not included, it defaults to a slash (/).
This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
- roles string[]
- The name of the role to associate with the instance profile. Only one role can be assigned to an EC2 instance at a time, and all applications on the instance share the same role and permissions.
- instance
Profile stringName - The name of the instance profile to create. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- path string
- The path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide.
This parameter is optional. If it is not included, it defaults to a slash (/).
This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
- roles Sequence[str]
- The name of the role to associate with the instance profile. Only one role can be assigned to an EC2 instance at a time, and all applications on the instance share the same role and permissions.
- instance_
profile_ strname - The name of the instance profile to create. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- path str
- The path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide.
This parameter is optional. If it is not included, it defaults to a slash (/).
This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
- roles List<String>
- The name of the role to associate with the instance profile. Only one role can be assigned to an EC2 instance at a time, and all applications on the instance share the same role and permissions.
- instance
Profile StringName - The name of the instance profile to create. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
- path String
- The path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide.
This parameter is optional. If it is not included, it defaults to a slash (/).
This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (
\u0021
) through the DEL character (\u007F
), including most punctuation characters, digits, and upper and lowercased letters.
Outputs
All input properties are implicitly available as output properties. Additionally, the InstanceProfile resource produces the following output properties:
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
We recommend new projects start with resources from the AWS provider.