class aws_cdk.aws_ec2.InstanceRequireImdsv2Aspect(*, suppress_launch_template_warning=None, suppress_warnings=None)

Bases: object

Aspect that applies IMDS configuration on EC2 Instance constructs.

This aspect configures IMDS on an EC2 instance by creating a Launch Template with the IMDS configuration and associating that Launch Template with the instance. If an Instance is already associated with a Launch Template, a warning will (optionally) be added to the construct node and it will be skipped.

To cover Instances already associated with Launch Templates, use LaunchTemplateImdsAspect.


aspect = ec2.InstanceRequireImdsv2Aspect()
  • suppress_launch_template_warning (Optional[bool]) – Whether warnings that would be raised when an Instance is associated with an existing Launch Template should be suppressed or not. You can set this to true if LaunchTemplateImdsAspect is being used alongside this Aspect to suppress false-positive warnings because any Launch Templates associated with Instances will still be covered. Default: - false

  • suppress_warnings (Optional[bool]) – Whether warning annotations from this Aspect should be suppressed or not. Default: - false



All aspects can visit an IConstruct.


node (IConstruct) –

Return type