InstanceProfileProps
- class aws_cdk.aws_iam.InstanceProfileProps(*, instance_profile_name=None, path=None, role=None)
Bases:
objectProperties of an Instance Profile.
- Parameters:
instance_profile_name (
Optional[str]) – The name of the InstanceProfile to create. Default: - generated by CloudFormationpath (
Optional[str]) – The path to the InstanceProfile. Default: /role (
Optional[IRole]) – An IAM role to associate with the instance profile that is used by EC2 instances. The role must be assumable by the service principalec2.amazonaws.com: Default: - a role will be automatically created, it can be accessed via theroleproperty
- ExampleMetadata:
infused
Example:
# vpc: ec2.Vpc role = iam.Role(self, "Role", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com") ) instance_profile = iam.InstanceProfile(self, "InstanceProfile", role=role ) template = ec2.LaunchTemplate(self, "LaunchTemplate", launch_template_name="MyTemplateV1", version_description="This is my v1 template", machine_image=ec2.MachineImage.latest_amazon_linux2023(), security_group=ec2.SecurityGroup(self, "LaunchTemplateSG", vpc=vpc ), instance_profile=instance_profile )
Attributes
- instance_profile_name
The name of the InstanceProfile to create.
- Default:
generated by CloudFormation
- path
The path to the InstanceProfile.
- Default:
/
- role
An IAM role to associate with the instance profile that is used by EC2 instances.
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
roleproperty
Example:
role = iam.Role(self, "MyRole", assumed_by=iam.ServicePrincipal("ec2.amazonaws.com") )