# InstanceProfileProps

Properties of an Instance Profile.

Extends: InstanceProfileProps
Used as props by: InstanceProfile

- Source: [`aws-iam/lib/instance-profile.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-iam/lib/instance-profile.ts#L38)
- Type last changed: v2.88.0 · 20 Jul 2023

## 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

- `instanceProfileName`: string — The name of the InstanceProfile to create.

  **Default:** generated by CloudFormation

- `path`: string = / — The path to the InstanceProfile.

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — 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`:

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