Interface IInstanceProfileProps
Properties of an Instance Profile.
Namespace: Amazon.CDK.AWS.IAM
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IInstanceProfileProps
Syntax (vb)
Public Interface IInstanceProfileProps
Remarks
ExampleMetadata: infused
Examples
Vpc vpc;
var role = new Role(this, "Role", new RoleProps {
AssumedBy = new ServicePrincipal("ec2.amazonaws.com")
});
var instanceProfile = new InstanceProfile(this, "InstanceProfile", new InstanceProfileProps {
Role = role
});
var template = new LaunchTemplate(this, "LaunchTemplate", new LaunchTemplateProps {
LaunchTemplateName = "MyTemplateV1",
VersionDescription = "This is my v1 template",
MachineImage = MachineImage.LatestAmazonLinux2023(),
SecurityGroup = new SecurityGroup(this, "LaunchTemplateSG", new SecurityGroupProps {
Vpc = vpc
}),
InstanceProfile = instanceProfile
});
Synopsis
Properties
| InstanceProfileName | The name of the InstanceProfile to create. |
| Path | The path to the InstanceProfile. |
| Role | An IAM role to associate with the instance profile that is used by EC2 instances. |
Properties
InstanceProfileName
The name of the InstanceProfile to create.
string? InstanceProfileName { get; }
Property Value
Remarks
Default: - generated by CloudFormation
Path
Role
An IAM role to associate with the instance profile that is used by EC2 instances.
IRole? Role { get; }
Property Value
Remarks
The role must be assumable by the service principal ec2.amazonaws.com:
Default: - a role will be automatically created, it can be accessed via the role property
Examples
var role = new Role(this, "MyRole", new RoleProps {
AssumedBy = new ServicePrincipal("ec2.amazonaws.com")
});