LifecyclePolicyExclusionRules
- class aws_cdk.aws_imagebuilder_alpha.LifecyclePolicyExclusionRules(*, ami_exclusion_rules=None, image_exclusion_rules=None)
Bases:
object(experimental) The rules to apply for excluding resources from the lifecycle policy rule.
- Parameters:
ami_exclusion_rules (
Union[LifecyclePolicyAmiExclusionRules,Dict[str,Any],None]) – (experimental) The rules to apply for excluding AMIs from the lifecycle policy rule. Default: - no exclusion rules are applied on the AMIimage_exclusion_rules (
Union[LifecyclePolicyImageExclusionRules,Dict[str,Any],None]) – (experimental) The rules to apply for excluding EC2 Image Builder images from the lifecycle policy rule. Default: - no exclusion rules are applied on the image
- Stability:
experimental
- ExampleMetadata:
infused
Example:
exclude_amis_policy = imagebuilder.LifecyclePolicy(self, "ExcludeAmisPolicy", resource_type=imagebuilder.LifecyclePolicyResourceType.AMI_IMAGE, details=[imagebuilder.LifecyclePolicyDetail( action=imagebuilder.LifecyclePolicyAction(type=imagebuilder.LifecyclePolicyActionType.DELETE), filter=imagebuilder.LifecyclePolicyFilter(age_filter=imagebuilder.LifecyclePolicyAgeFilter(age=Duration.days(30))), exclusion_rules=imagebuilder.LifecyclePolicyExclusionRules( ami_exclusion_rules=imagebuilder.LifecyclePolicyAmiExclusionRules( is_public=True, # Exclude public AMIs last_launched=Duration.days(7), # Exclude AMIs launched in last 7 days regions=["us-west-2", "eu-west-1"], # Exclude AMIs in specific regions shared_accounts=["123456789012"], # Exclude AMIs shared with specific accounts tags={ "Protected": "true", "Environment": "production" } ) ) ) ], resource_selection=imagebuilder.LifecyclePolicyResourceSelection( tags={"Team": "infrastructure"} ) )
Attributes
- ami_exclusion_rules
(experimental) The rules to apply for excluding AMIs from the lifecycle policy rule.
- Default:
no exclusion rules are applied on the AMI
- Stability:
experimental
- image_exclusion_rules
(experimental) The rules to apply for excluding EC2 Image Builder images from the lifecycle policy rule.
- Default:
no exclusion rules are applied on the image
- Stability:
experimental