Skip to content
v2.274.0

InstanceProfileProps Struct ​

Properties of an Instance Profile.

Example ​

ts
declare const vpc: ec2.Vpc;

const role = new iam.Role(this, 'Role', {
  assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
});
const instanceProfile = new iam.InstanceProfile(this, 'InstanceProfile', {
  role,
});

const template = new ec2.LaunchTemplate(this, 'LaunchTemplate', {
  launchTemplateName: 'MyTemplateV1',
  versionDescription: 'This is my v1 template',
  machineImage: ec2.MachineImage.latestAmazonLinux2023(),
  securityGroup: new ec2.SecurityGroup(this, 'LaunchTemplateSG', {
    vpc: vpc,
  }),
  instanceProfile,
});

Properties ​

instanceProfileNameoptionalstringinstance_profile_nameoptionalstrinstanceProfileNameoptionalStringInstanceProfileNameoptionalstringInstanceProfileNameoptional*string#
The name of the InstanceProfile to create.

Default: generated by CloudFormation

pathoptionalstringpathoptionalstrpathoptionalStringPathoptionalstringPathoptional*string= /#
The path to the InstanceProfile.
roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
An IAM role to associate with the instance profile that is used by EC2 instances.

Default: a role will be automatically created, it can be accessed via the role property

The role must be assumable by the service principal ec2.amazonaws.com:

example
ts
const role = new iam.Role(this, 'MyRole', {
  assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com')
});