Source code for botocraft.services.autoscaling

# This file is automatically generated by botocraft.  Do not edit directly.
# mypy: disable-error-code="index, override, assignment, union-attr, misc"
from botocraft.services.ec2 import LaunchTemplateVersion, LaunchTemplateVersionManager
from .abstract import (
    Boto3Model,
    ReadonlyBoto3Model,
    PrimaryBoto3Model,
    ReadonlyPrimaryBoto3Model,
    Boto3ModelManager,
    ReadonlyBoto3ModelManager,
)
from .abstract import PrimaryBoto3ModelQuerySet
from datetime import datetime
import builtins
from botocraft.services.ec2 import EC2InstanceType, EC2InstanceTypeManager
from botocraft.services.common import Filter
from botocraft.services.ec2 import SecurityGroup, SecurityGroupManager
from functools import cached_property
from pydantic import Field
from botocraft.services.ec2 import AMI, AMIManager
from collections import OrderedDict
from typing import ClassVar, Literal, Any, cast
from botocraft.mixins.tags import TagsDictMixin
from botocraft.services.common import Tag
from botocraft.mixins.autoscaling import AutoScalingGroupModelMixin

# ===============
# Managers
# ===============


[docs]class AutoScalingGroupManager(Boto3ModelManager): service_name: str = "autoscaling"
[docs] def create( self, model: "AutoScalingGroup", InstanceId: "str | None" = None, LifecycleHookSpecificationList: "builtins.list[LifecycleHookSpecification] | None" = None, SkipZonalShiftValidation: "bool | None" = None, ) -> None: """ **We strongly recommend using a launch template when calling this operation to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2.** Args: model: The :py:class:`AutoScalingGroup` to create. Keyword Args: InstanceId: The ID of the instance used to base the launch configuration on. If specified, Amazon EC2 Auto Scaling uses the configuration values from the specified instance to create a new launch configuration. To get the instance ID, use the Amazon EC2 `DescribeInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html>`_ API operation. For more information, see `Create an Auto Scaling group using parameters from an existing instance <https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-from-instance.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. LifecycleHookSpecificationList: One or more lifecycle hooks to add to the Auto Scaling group before instances are launched. SkipZonalShiftValidation: If you enable zonal shift with cross-zone disabled load balancers, capacity could become imbalanced across Availability Zones. To skip the validation, specify ``true``. For more information, see `Auto Scaling group zonal shift <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-zonal- shift.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ data = model.model_dump(exclude_none=True, by_alias=True) args = dict( AutoScalingGroupName=data.get("AutoScalingGroupName"), MinSize=data.get("MinSize"), MaxSize=data.get("MaxSize"), LaunchConfigurationName=data.get("LaunchConfigurationName"), LaunchTemplate=data.get("LaunchTemplate"), MixedInstancesPolicy=data.get("MixedInstancesPolicy"), InstanceId=self.serialize(InstanceId), DesiredCapacity=data.get("DesiredCapacity"), DefaultCooldown=data.get("DefaultCooldown"), AvailabilityZones=data.get("AvailabilityZones"), AvailabilityZoneIds=data.get("AvailabilityZoneIds"), LoadBalancerNames=data.get("LoadBalancerNames"), TargetGroupARNs=data.get("TargetGroupARNs"), HealthCheckType=data.get("HealthCheckType"), HealthCheckGracePeriod=data.get("HealthCheckGracePeriod"), PlacementGroup=data.get("PlacementGroup"), VPCZoneIdentifier=data.get("VPCZoneIdentifier"), TerminationPolicies=data.get("TerminationPolicies"), NewInstancesProtectedFromScaleIn=data.get( "NewInstancesProtectedFromScaleIn" ), CapacityRebalance=data.get("CapacityRebalance"), LifecycleHookSpecificationList=self.serialize( LifecycleHookSpecificationList ), DeletionProtection=data.get("DeletionProtection"), Tags=data.get("Tags"), ServiceLinkedRoleARN=data.get("ServiceLinkedRoleARN"), MaxInstanceLifetime=data.get("MaxInstanceLifetime"), Context=data.get("Context"), DesiredCapacityType=data.get("DesiredCapacityType"), DefaultInstanceWarmup=data.get("DefaultInstanceWarmup"), TrafficSources=data.get("TrafficSources"), InstanceMaintenancePolicy=data.get("InstanceMaintenancePolicy"), AvailabilityZoneDistribution=data.get("AvailabilityZoneDistribution"), AvailabilityZoneImpairmentPolicy=data.get( "AvailabilityZoneImpairmentPolicy" ), SkipZonalShiftValidation=self.serialize(SkipZonalShiftValidation), CapacityReservationSpecification=data.get( "CapacityReservationSpecification" ), InstanceLifecyclePolicy=data.get("InstanceLifecyclePolicy"), ) self.client.create_auto_scaling_group( **{k: v for k, v in args.items() if v is not None} )
[docs] def update( self, model: "AutoScalingGroup", SkipZonalShiftValidation: "bool | None" = None ) -> None: """ **We strongly recommend that all Auto Scaling groups use launch templates to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2.** Args: model: The :py:class:`AutoScalingGroup` to update. Keyword Args: SkipZonalShiftValidation: If you enable zonal shift with cross-zone disabled load balancers, capacity could become imbalanced across Availability Zones. To skip the validation, specify ``true``. For more information, see `Auto Scaling group zonal shift <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-zonal- shift.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ data = model.model_dump(exclude_none=True, by_alias=True) args = dict( AutoScalingGroupName=data.get("AutoScalingGroupName"), LaunchConfigurationName=data.get("LaunchConfigurationName"), LaunchTemplate={ "LaunchTemplateId": data["LaunchTemplate"]["LaunchTemplateId"], "Version": data["LaunchTemplate"]["Version"], } if "LaunchTemplate" in data else None, MixedInstancesPolicy=data.get("MixedInstancesPolicy"), MinSize=data.get("MinSize"), MaxSize=data.get("MaxSize"), DesiredCapacity=data.get("DesiredCapacity"), DefaultCooldown=data.get("DefaultCooldown"), AvailabilityZones=data.get("AvailabilityZones"), AvailabilityZoneIds=data.get("AvailabilityZoneIds"), HealthCheckType=data.get("HealthCheckType"), HealthCheckGracePeriod=data.get("HealthCheckGracePeriod"), PlacementGroup=data.get("PlacementGroup"), VPCZoneIdentifier=data.get("VPCZoneIdentifier"), TerminationPolicies=data.get("TerminationPolicies"), NewInstancesProtectedFromScaleIn=data.get( "NewInstancesProtectedFromScaleIn" ), ServiceLinkedRoleARN=data.get("ServiceLinkedRoleARN"), MaxInstanceLifetime=data.get("MaxInstanceLifetime"), CapacityRebalance=data.get("CapacityRebalance"), Context=data.get("Context"), DesiredCapacityType=data.get("DesiredCapacityType"), DefaultInstanceWarmup=data.get("DefaultInstanceWarmup"), InstanceMaintenancePolicy=data.get("InstanceMaintenancePolicy"), AvailabilityZoneDistribution=data.get("AvailabilityZoneDistribution"), AvailabilityZoneImpairmentPolicy=data.get( "AvailabilityZoneImpairmentPolicy" ), SkipZonalShiftValidation=self.serialize(SkipZonalShiftValidation), CapacityReservationSpecification=data.get( "CapacityReservationSpecification" ), InstanceLifecyclePolicy=data.get("InstanceLifecyclePolicy"), DeletionProtection=data.get("DeletionProtection"), ) self.client.update_auto_scaling_group( **{k: v for k, v in args.items() if v is not None} )
[docs] def delete( self, AutoScalingGroupName: str, *, ForceDelete: "bool | None" = None ) -> None: """ Deletes the specified Auto Scaling group. Args: AutoScalingGroupName: The name of the Auto Scaling group. Keyword Args: ForceDelete: Specifies that the group is to be deleted along with all instances associated with the group, without waiting for all instances to be terminated. This action also deletes any outstanding lifecycle actions associated with the group. """ args: dict[str, Any] = dict( AutoScalingGroupName=self.serialize(AutoScalingGroupName), ForceDelete=self.serialize(ForceDelete), ) self.client.delete_auto_scaling_group( **{k: v for k, v in args.items() if v is not None} )
[docs] def get( self, AutoScalingGroupName: str, *, IncludeInstances: "bool | None" = None ) -> "AutoScalingGroup | None": """ Gets information about the Auto Scaling groups in the account and Region. Args: AutoScalingGroupName: The name of the Auto Scaling group. The name can be a maximum of 1600 characters. Keyword Args: IncludeInstances: Specifies whether to include information about Amazon EC2 instances in the response. When set to ``true`` (default), the response includes instance details. """ args: dict[str, Any] = dict( AutoScalingGroupNames=self.serialize([AutoScalingGroupName]), IncludeInstances=self.serialize(IncludeInstances), ) _response = self.client.describe_auto_scaling_groups( **{k: v for k, v in args.items() if v is not None} ) response = AutoScalingGroupsType(**_response) if response and response.AutoScalingGroups: self.sessionize(response.AutoScalingGroups[0]) return response.AutoScalingGroups[0] return None
[docs] def list( self, *, AutoScalingGroupNames: "builtins.list[str] | None" = None, IncludeInstances: "bool | None" = None, Filters: "builtins.list[Filter] | None" = None, ) -> PrimaryBoto3ModelQuerySet: """ Gets information about the Auto Scaling groups in the account and Region. Keyword Args: AutoScalingGroupNames: The names of the Auto Scaling groups. By default, you can only specify up to 50 names. You can optionally increase this limit using the ``MaxRecords`` property. IncludeInstances: Specifies whether to include information about Amazon EC2 instances in the response. When set to ``true`` (default), the response includes instance details. Filters: One or more filters to limit the results based on specific tags. """ paginator = self.client.get_paginator("describe_auto_scaling_groups") args: dict[str, Any] = dict( AutoScalingGroupNames=self.serialize(AutoScalingGroupNames), IncludeInstances=self.serialize(IncludeInstances), Filters=self.serialize(Filters), ) response_iterator = paginator.paginate( **{k: v for k, v in args.items() if v is not None} ) results = [] for _response in response_iterator: if list(_response.keys()) == ["ResponseMetadata"]: break if "ResponseMetadata" in _response: del _response["ResponseMetadata"] response = AutoScalingGroupsType(**_response) if response.AutoScalingGroups: results.extend(response.AutoScalingGroups) else: if getattr(response, "NextToken", None): continue break self.sessionize(results) if results and isinstance(results[0], Boto3Model): return PrimaryBoto3ModelQuerySet(results) return results
[docs] def scale(self, AutoScalingGroupName: str, DesiredCapacity: int) -> None: """ Sets the size of the specified Auto Scaling group. Args: AutoScalingGroupName: The name of the Auto Scaling group. DesiredCapacity: The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain. """ args: dict[str, Any] = dict( AutoScalingGroupName=self.serialize(AutoScalingGroupName), DesiredCapacity=self.serialize(DesiredCapacity), HonorCooldown=False, ) self.client.set_desired_capacity( **{k: v for k, v in args.items() if v is not None} )
[docs] def instance_status( self, *, InstanceIds: "builtins.list[str] | None" = None ) -> "builtins.list[AutoScalingInstanceDetails]": """ Gets information about the Auto Scaling instances in the account and Region. Keyword Args: InstanceIds: The IDs of the instances. If you omit this property, all Auto Scaling instances are described. If you specify an ID that does not exist, it is ignored with no error. """ paginator = self.client.get_paginator("describe_auto_scaling_instances") args: dict[str, Any] = dict(InstanceIds=self.serialize(InstanceIds)) response_iterator = paginator.paginate( **{k: v for k, v in args.items() if v is not None} ) results: "builtins.list[AutoScalingInstanceDetails]" = [] for _response in response_iterator: response = AutoScalingInstancesType(**_response) if response.AutoScalingInstances is not None: results.extend(response.AutoScalingInstances) else: break self.sessionize(results) return cast("builtins.list[AutoScalingInstanceDetails]", results)
[docs] def terminate_instance( self, InstanceId: str, ShouldDecrementDesiredCapacity: bool ) -> "ActivityType": """ Terminates the specified instance and optionally adjusts the desired group size. This operation cannot be called on instances in a warm pool. Args: InstanceId: The ID of the instance. ShouldDecrementDesiredCapacity: Indicates whether terminating the instance also decrements the size of the Auto Scaling group. """ args: dict[str, Any] = dict( InstanceId=self.serialize(InstanceId), ShouldDecrementDesiredCapacity=self.serialize( ShouldDecrementDesiredCapacity ), ) _response = self.client.terminate_instance_in_auto_scaling_group( **{k: v for k, v in args.items() if v is not None} ) response = ActivityType(**_response) results: "ActivityType" = None if response is not None: results = response self.sessionize(results) return cast("ActivityType", results)
[docs]class LaunchConfigurationManager(Boto3ModelManager): service_name: str = "autoscaling"
[docs] def create( self, model: "LaunchConfiguration", InstanceId: "str | None" = None ) -> None: """ Creates a launch configuration. Args: model: The :py:class:`LaunchConfiguration` to create. Keyword Args: InstanceId: The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, except for the block device mapping. """ data = model.model_dump(exclude_none=True, by_alias=True) args = dict( LaunchConfigurationName=data.get("LaunchConfigurationName"), ImageId=data.get("ImageId"), KeyName=data.get("KeyName"), SecurityGroups=data.get("SecurityGroups"), ClassicLinkVPCId=data.get("ClassicLinkVPCId"), ClassicLinkVPCSecurityGroups=data.get("ClassicLinkVPCSecurityGroups"), UserData=data.get("UserData"), InstanceId=self.serialize(InstanceId), InstanceType=data.get("InstanceType"), KernelId=data.get("KernelId"), RamdiskId=data.get("RamdiskId"), BlockDeviceMappings=data.get("BlockDeviceMappings"), InstanceMonitoring=data.get("InstanceMonitoring"), SpotPrice=data.get("SpotPrice"), IamInstanceProfile=data.get("IamInstanceProfile"), EbsOptimized=data.get("EbsOptimized"), AssociatePublicIpAddress=data.get("AssociatePublicIpAddress"), PlacementTenancy=data.get("PlacementTenancy"), MetadataOptions=data.get("MetadataOptions"), ) self.client.create_launch_configuration( **{k: v for k, v in args.items() if v is not None} )
[docs] def delete(self, LaunchConfigurationName: str) -> None: """ Deletes the specified launch configuration. Args: LaunchConfigurationName: The name of the launch configuration. """ args: dict[str, Any] = dict( LaunchConfigurationName=self.serialize(LaunchConfigurationName) ) self.client.delete_launch_configuration( **{k: v for k, v in args.items() if v is not None} )
[docs] def get(self, LaunchConfigurationName: str) -> "LaunchConfiguration | None": """ Gets information about the launch configurations in the account and Region. Args: LaunchConfigurationName: The name of the launch configuration. This name must be unique per Region per account. """ args: dict[str, Any] = dict( LaunchConfigurationNames=self.serialize([LaunchConfigurationName]) ) _response = self.client.describe_launch_configurations( **{k: v for k, v in args.items() if v is not None} ) response = LaunchConfigurationsType(**_response) if response and response.LaunchConfigurations: self.sessionize(response.LaunchConfigurations[0]) return response.LaunchConfigurations[0] return None
[docs] def list( self, *, LaunchConfigurationNames: "builtins.list[str] | None" = None ) -> PrimaryBoto3ModelQuerySet: """ Gets information about the launch configurations in the account and Region. Keyword Args: LaunchConfigurationNames: The launch configuration names. If you omit this property, all launch configurations are described. """ paginator = self.client.get_paginator("describe_launch_configurations") args: dict[str, Any] = dict( LaunchConfigurationNames=self.serialize(LaunchConfigurationNames) ) response_iterator = paginator.paginate( **{k: v for k, v in args.items() if v is not None} ) results = [] for _response in response_iterator: if list(_response.keys()) == ["ResponseMetadata"]: break if "ResponseMetadata" in _response: del _response["ResponseMetadata"] response = LaunchConfigurationsType(**_response) if response.LaunchConfigurations: results.extend(response.LaunchConfigurations) else: if getattr(response, "NextToken", None): continue break self.sessionize(results) if results and isinstance(results[0], Boto3Model): return PrimaryBoto3ModelQuerySet(results) return results
# ============== # Service Models # ==============
[docs]class AutoScalingLaunchTemplateSpecification(Boto3Model): """ Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to launch Amazon EC2 instances. For more information about launch templates, see `Launch templates <https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-templates.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ LaunchTemplateId: "str | None" = None """ The ID of the launch template. To get the template ID, use the Amazon EC2 `DescribeLaunchTemplates <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplates.html>`_ API operation. New launch templates can be created using the Amazon EC2 `CreateLaunchTemplate <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplate.html>`_ API. """ LaunchTemplateName: "str | None" = None """ The name of the launch template. To get the template name, use the Amazon EC2 `DescribeLaunchTemplates <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplates.html>`_ API operation. New launch templates can be created using the Amazon EC2 `CreateLaunchTemplate <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplate.html>`_ API. """ Version: "str | None" = None """ The version number, ``$Latest``, or ``$Default``. To get the version number, use the Amazon EC2 `DescribeLaunchTemplateV ersions <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplateVersions.html>`_ API operation. New launch template versions can be created using the Amazon EC2 `CreateLaunchTemplateVersion <https://docs.aws.amazon.c om/AWSEC2/latest/APIReference/API_CreateLaunchTemplateVersion.html>`_ API. If the value is ``$Latest``, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is ``$Default``, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is ``$Default``. """
[docs]class VCpuCountRequest(Boto3Model): """Specifies the minimum and maximum for the ``VCpuCount`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. """ Min: int """ The minimum number of vCPUs. """ Max: "int | None" = None """ The maximum number of vCPUs. """
[docs]class AutoScalingMemoryMiBRequest(Boto3Model): """Specifies the minimum and maximum for the ``MemoryMiB`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. """ Min: int """ The memory minimum in MiB. """ Max: "int | None" = None """ The memory maximum in MiB. """
[docs]class MemoryGiBPerVCpuRequest(Boto3Model): """Specifies the minimum and maximum for the ``MemoryGiBPerVCpu`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. """ Min: "float | None" = None """ The memory minimum in GiB. """ Max: "float | None" = None """ The memory maximum in GiB. """
[docs]class AutoScalingNetworkInterfaceCountRequest(Boto3Model): """Specifies the minimum and maximum for the ``NetworkInterfaceCount`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. """ Min: "int | None" = None """ The minimum number of network interfaces. """ Max: "int | None" = None """ The maximum number of network interfaces. """
[docs]class AutoScalingTotalLocalStorageGBRequest(Boto3Model): """Specifies the minimum and maximum for the ``TotalLocalStorageGB`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. """ Min: "float | None" = None """ The storage minimum in GB. """ Max: "float | None" = None """ The storage maximum in GB. """
[docs]class AutoScalingBaselineEbsBandwidthMbsRequest(Boto3Model): """Specifies the minimum and maximum for the ``BaselineEbsBandwidthMbps`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. """ Min: "int | None" = None """ The minimum value in Mbps. """ Max: "int | None" = None """ The maximum value in Mbps. """
[docs]class AutoScalingAcceleratorCountRequest(Boto3Model): """Specifies the minimum and maximum for the ``AcceleratorCount`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. """ Min: "int | None" = None """ The minimum value. """ Max: "int | None" = None """ The maximum value. """
[docs]class AutoScalingAcceleratorTotalMemoryMiBRequest(Boto3Model): """Specifies the minimum and maximum for the ``AcceleratorTotalMemoryMiB`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. """ Min: "int | None" = None """ The memory minimum in MiB. """ Max: "int | None" = None """ The memory maximum in MiB. """
[docs]class NetworkBandwidthGbpsRequest(Boto3Model): """Specifies the minimum and maximum for the ``NetworkBandwidthGbps`` object when you specify `InstanceRequirements <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstanceRequirements.html>`_ for an Auto Scaling group. Setting the minimum bandwidth does not guarantee that your instance will achieve the minimum bandwidth. Amazon EC2 will identify instance types that support the specified minimum bandwidth, but the actual bandwidth of your instance might go below the specified minimum at times. For more information, see `Available instance bandwidth <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-network-bandwidth.html#available-instance- bandwidth>`_ in the *Amazon EC2 User Guide*. """ Min: "float | None" = None """ The minimum amount of network bandwidth, in gigabits per second (Gbps). """ Max: "float | None" = None """ The maximum amount of network bandwidth, in gigabits per second (Gbps). """
[docs]class AutoScalingPerformanceFactorReferenceRequest(Boto3Model): """ Specify an instance family to use as the baseline reference for CPU performance. All instance types that All instance types that match your specified attributes will be compared against the CPU performance of the referenced instance family, regardless of CPU manufacturer or architecture differences. Currently only one instance family can be specified in the list. """ InstanceFamily: "str | None" = None """ The instance family to use as a baseline reference. """
[docs]class AutoScalingCpuPerformanceFactorRequest(Boto3Model): """ The CPU performance to consider, using an instance family as the baseline reference. """ References: "builtins.list[AutoScalingPerformanceFactorReferenceRequest] | None" = ( Field(default_factory=list) ) """ Specify an instance family to use as the baseline reference for CPU performance. All instance types that match your specified attributes will be compared against the CPU performance of the referenced instance family, regardless of CPU manufacturer or architecture differences. """
[docs]class AutoScalingBaselinePerformanceFactorsRequest(Boto3Model): """ The baseline performance to consider, using an instance family as a baseline reference. The instance family establishes the lowest acceptable level of performance. Auto Scaling uses this baseline to guide instance type selection, but there is no guarantee that the selected instance types will always exceed the baseline for every application. Currently, this parameter only supports CPU performance as a baseline performance factor. For example, specifying ``c6i`` uses the CPU performance of the ``c6i`` family as the baseline reference. """ Cpu: "AutoScalingCpuPerformanceFactorRequest | None" = None """ The CPU performance to consider, using an instance family as the baseline reference. """
[docs]class AutoScalingInstanceRequirements(Boto3Model): """ The attributes for the instance types for a mixed instances policy. Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types. When you specify multiple attributes, you get instance types that satisfy all of the specified attributes. If you specify multiple values for an attribute, you get instance types that satisfy any of the specified values. To limit the list of instance types from which Amazon EC2 Auto Scaling can identify matching instance types, you can use one of the following parameters, but not both in the same request: * ``AllowedInstanceTypes`` - The instance types to include in the list. All other instance types are ignored, even if they match your specified attributes. * ``ExcludedInstanceTypes`` - The instance types to exclude from the list, even if they match your specified attributes. You must specify ``VCpuCount`` and ``MemoryMiB``. All other attributes are optional. Any unspecified optional attribute is set to its default. For more information, see `Create a mixed instances group using attribute-based instance type selection <https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-mixed-instances-group-attribute-based-instance- type-selection.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. For help determining which instance types match your attributes before you apply them to your Auto Scaling group, see `Preview instance types with specified attributes <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-attribute-based-instance-type- selection.html#ec2fleet-get-instance-types-from-instance-requirements>`_ in the *Amazon EC2 User Guide*. """ VCpuCount: VCpuCountRequest """ The minimum and maximum number of vCPUs for an instance type. """ MemoryMiB: AutoScalingMemoryMiBRequest """ The minimum and maximum instance memory size for an instance type, in MiB. """ CpuManufacturers: "builtins.list[Literal['intel', 'amd', 'amazon-web-services', 'apple']] | None" = Field( default_factory=list ) """ Lists which specific CPU manufacturers to include. """ MemoryGiBPerVCpu: "MemoryGiBPerVCpuRequest | None" = None """ The minimum and maximum amount of memory per vCPU for an instance type, in GiB. """ ExcludedInstanceTypes: "builtins.list[str] | None" = Field(default_factory=list) """ The instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (``*``), to exclude an instance family, type, size, or generation. The following are examples: ``m5.8xlarge``, ``c5*.*``, ``m5a.*``, ``r*``, ``*3*``. """ InstanceGenerations: "builtins.list[Literal['current', 'previous']] | None" = Field( default_factory=list ) """ Indicates whether current or previous generation instance types are included. """ SpotMaxPricePercentageOverLowestPrice: "int | None" = None """ [Price protection] The price protection threshold for Spot Instances, as a percentage higher than an identified Spot price. The identified Spot price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold. """ MaxSpotPriceAsPercentageOfOptimalOnDemandPrice: "int | None" = None """ [Price protection] The price protection threshold for Spot Instances, as a percentage of an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold. """ OnDemandMaxPricePercentageOverLowestPrice: "int | None" = None """ [Price protection] The price protection threshold for On-Demand Instances, as a percentage higher than an identified On- Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from either the lowest priced current generation instance types or, failing that, the lowest priced previous generation instance types that match your attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price exceeds your specified threshold. """ BareMetal: "Literal['included', 'excluded', 'required'] | None" = None """ Indicates whether bare metal instance types are included, excluded, or required. """ BurstablePerformance: "Literal['included', 'excluded', 'required'] | None" = None """ Indicates whether burstable performance instance types are included, excluded, or required. For more information, see `Burstable performance instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance- instances.html>`_ in the *Amazon EC2 User Guide*. """ RequireHibernateSupport: "bool | None" = None """ Indicates whether instance types must provide On-Demand Instance hibernation support. """ NetworkInterfaceCount: "AutoScalingNetworkInterfaceCountRequest | None" = None """ The minimum and maximum number of network interfaces for an instance type. """ LocalStorage: "Literal['included', 'excluded', 'required'] | None" = None """ Indicates whether instance types with instance store volumes are included, excluded, or required. For more information, see `Amazon EC2 instance store <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html>`_ in the *Amazon EC2 User Guide*. """ LocalStorageTypes: "builtins.list[Literal['hdd', 'ssd']] | None" = Field( default_factory=list ) """ Indicates the type of local storage that is required. """ TotalLocalStorageGB: "AutoScalingTotalLocalStorageGBRequest | None" = None """ The minimum and maximum total local storage size for an instance type, in GB. """ BaselineEbsBandwidthMbps: "AutoScalingBaselineEbsBandwidthMbsRequest | None" = None """ The minimum and maximum baseline bandwidth performance for an instance type, in Mbps. For more information, see `Amazon EBS-optimized instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html>`_ in the *Amazon EC2 User Guide*. """ AcceleratorTypes: "builtins.list[Literal['gpu', 'fpga', 'inference']] | None" = ( Field(default_factory=list) ) """ Lists the accelerator types that must be on an instance type. """ AcceleratorCount: "AutoScalingAcceleratorCountRequest | None" = None """ The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services Inferentia chips) for an instance type. """ AcceleratorManufacturers: "builtins.list[Literal['nvidia', 'amd', 'amazon-web-services', 'xilinx']] | None" = Field( default_factory=list ) """ Indicates whether instance types must have accelerators by specific manufacturers. """ AcceleratorNames: "builtins.list[Literal['a100', 'v100', 'k80', 't4', 'm60', 'radeon-pro-v520', 'vu9p']] | None" = Field( default_factory=list ) """ Lists the accelerators that must be on an instance type. """ AcceleratorTotalMemoryMiB: "AutoScalingAcceleratorTotalMemoryMiBRequest | None" = ( None ) """ The minimum and maximum total memory size for the accelerators on an instance type, in MiB. """ NetworkBandwidthGbps: "NetworkBandwidthGbpsRequest | None" = None """ The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps). """ AllowedInstanceTypes: "builtins.list[str] | None" = Field(default_factory=list) """ The instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes. """ BaselinePerformanceFactors: "AutoScalingBaselinePerformanceFactorsRequest | None" = None """ The baseline performance factors for the instance requirements. """
[docs]class LaunchTemplateOverrides(Boto3Model): """Use this structure to let Amazon EC2 Auto Scaling do the following when the Auto Scaling group has a mixed instances policy: * Override the instance type that is specified in the launch template. * Use multiple instance types. Specify the instance types that you want, or define your instance requirements instead and let Amazon EC2 Auto Scaling provision the available instance types that meet your requirements. This can provide Amazon EC2 Auto Scaling with a larger selection of instance types to choose from when fulfilling Spot and On-Demand capacities. You can view which instance types are matched before you apply the instance requirements to your Auto Scaling group. After you define your instance requirements, you don't have to keep updating these settings to get new EC2 instance types automatically. Amazon EC2 Auto Scaling uses the instance requirements of the Auto Scaling group to determine whether a new EC2 instance type can be used. """ InstanceType: "str | None" = None """ The instance type, such as ``m3.xlarge``. You must specify an instance type that is supported in your requested Region and Availability Zones. For more information, see `Instance types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html>`_ in the *Amazon EC2 User Guide*. """ WeightedCapacity: "str | None" = None """ If you provide a list of instance types to use, you can specify the number of capacity units provided by each instance type in terms of virtual CPUs, memory, storage, throughput, or other relative performance characteristic. When a Spot or On-Demand Instance is launched, the capacity units count toward the desired capacity. Amazon EC2 Auto Scaling launches instances until the desired capacity is totally fulfilled, even if this results in an overage. For example, if there are two units remaining to fulfill capacity, and Amazon EC2 Auto Scaling can only launch an instance with a ``WeightedCapacity`` of five units, the instance is launched, and the desired capacity is exceeded by three units. For more information, see `Configure an Auto Scaling group to use instance weights <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups-instance- weighting.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. Value must be in the range of 1-999. """ LaunchTemplateSpecification: "AutoScalingLaunchTemplateSpecification | None" = None """ Provides a launch template for the specified instance type or set of instance requirements. For example, some instance types might require a launch template with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch template that's specified in the ``LaunchTemplate`` definition. For more information, see `Specifying a different launch template for an instance type <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances- groups-launch-template-overrides.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ InstanceRequirements: "AutoScalingInstanceRequirements | None" = None """ The instance requirements. Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types. """ ImageId: "str | None" = None """ The ID of the Amazon Machine Image (AMI) to use for instances launched with this override. When using Instance Refresh with ``ReplaceRootVolume`` strategy, this specifies the AMI for root volume replacement operations. """
[docs]class AutoScalingLaunchTemplate(Boto3Model): """ Use this structure to specify the launch templates and instance types (overrides) for a mixed instances policy. """ LaunchTemplateSpecification: "AutoScalingLaunchTemplateSpecification | None" = None """ The launch template. """ Overrides: "builtins.list[LaunchTemplateOverrides] | None" = Field( default_factory=list ) """ Any properties that you specify override the same properties in the launch template. """
[docs]class AutoScalingInstancesDistribution(Boto3Model): """ Use this structure to specify the distribution of On-Demand Instances and Spot Instances and the allocation strategies used to fulfill On-Demand and Spot capacities for a mixed instances policy. """ OnDemandAllocationStrategy: "str | None" = None """ The allocation strategy to apply to your On-Demand Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify. """ OnDemandBaseCapacity: "int | None" = None """ The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. This base portion is launched first as your group scales. """ OnDemandPercentageAboveBaseCapacity: "int | None" = None """ Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond ``OnDemandBaseCapacity``. Expressed as a number (for example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). If set to 100, only On-Demand Instances are used. """ SpotAllocationStrategy: "str | None" = None """ The allocation strategy to apply to your Spot Instances when they are launched. Possible instance types are determined by the launch template overrides that you specify. """ SpotInstancePools: "int | None" = None """ The number of Spot Instance pools across which to allocate your Spot Instances. The Spot pools are determined from the different instance types in the overrides. Valid only when the ``SpotAllocationStrategy`` is ``lowest-price``. Value must be in the range of 1-20. """ SpotMaxPrice: "str | None" = None """ The maximum price per unit hour that you are willing to pay for a Spot Instance. If your maximum price is lower than the Spot price for the instance types that you selected, your Spot Instances are not launched. We do not recommend specifying a maximum price because it can lead to increased interruptions. When Spot Instances launch, you pay the current Spot price. To remove a maximum price that you previously set, include the property but specify an empty string ("") for the value. """
[docs]class AutoScalingMixedInstancesPolicy(Boto3Model): """ Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group. A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help optimize your costs. For more information, see `Auto Scaling groups with multiple instance types and purchase options <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ LaunchTemplate: "AutoScalingLaunchTemplate | None" = None """ One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On- Demand and Spot capacities. """ InstancesDistribution: "AutoScalingInstancesDistribution | None" = None """ The instances distribution. """
[docs]class AutoScalingInstanceReference(Boto3Model): """ Describes an EC2 instance. """ InstanceId: str """ The ID of the instance. """ InstanceType: "str | None" = None """ The instance type of the EC2 instance. """ AvailabilityZone: str """ The Availability Zone in which the instance is running. """ AvailabilityZoneId: "str | None" = None """ The Availability Zone ID where the instance was launched. """ LifecycleState: Literal[ "Pending", "Pending:Wait", "Pending:Proceed", "Quarantined", "InService", "Terminating", "Terminating:Wait", "Terminating:Proceed", "Terminating:Retained", "Terminated", "Detaching", "Detached", "EnteringStandby", "Standby", "ReplacingRootVolume", "ReplacingRootVolume:Wait", "ReplacingRootVolume:Proceed", "RootVolumeReplaced", "Warmed:Pending", "Warmed:Pending:Wait", "Warmed:Pending:Proceed", "Warmed:Pending:Retained", "Warmed:Terminating", "Warmed:Terminating:Wait", "Warmed:Terminating:Proceed", "Warmed:Terminating:Retained", "Warmed:Terminated", "Warmed:Stopped", "Warmed:Running", "Warmed:Hibernated", ] """ A description of the current lifecycle state. The ``Quarantined`` state is not used. For more information, see `Amazon EC2 Auto Scaling instance lifecycle <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling- lifecycle.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ HealthStatus: str """ The last reported health status of the instance. ``Healthy`` means that the instance is healthy and should remain in service. ``Unhealthy`` means that the instance is unhealthy and that Amazon EC2 Auto Scaling should terminate and replace it. """ LaunchConfigurationName: "str | None" = None """ The launch configuration associated with the instance. """ LaunchTemplate: "AutoScalingLaunchTemplateSpecification | None" = None """ The launch template for the instance. """ ImageId: "str | None" = None """ The ID of the Amazon Machine Image (AMI) used for the instance's current root volume. This value reflects the most recent AMI applied to the instance, including updates made through root volume replacement operations. """ ProtectedFromScaleIn: bool """ Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in. """ WeightedCapacity: "str | None" = None """ The number of capacity units contributed by the instance based on its instance type. """
[docs]class SuspendedProcess(Boto3Model): """ Describes an auto scaling process that has been suspended. For more information, see `Types of processes <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume- processes.html#process-types>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ ProcessName: "str | None" = None """ The name of the suspended process. """ SuspensionReason: "str | None" = None """ The reason that the process was suspended. """
[docs]class EnabledMetric(Boto3Model): """ Describes an enabled Auto Scaling group metric. """ Metric: "str | None" = None """ One of the following metrics: """ Granularity: "str | None" = None """ The granularity of the metric. The only valid value is ``1Minute``. """
[docs]class AutoScalingTagDescription(Boto3Model): """ Describes a tag for an Auto Scaling group. """ ResourceId: "str | None" = None """ The name of the group. """ ResourceType: "str | None" = None """ The type of resource. The only supported value is ``auto-scaling-group``. """ Key: "str | None" = None """ The tag key. """ Value: "str | None" = None """ The tag value. """ PropagateAtLaunch: "bool | None" = None """ Determines whether the tag is added to new instances as they are launched in the group. """
[docs]class AutoScalingInstanceReusePolicy(Boto3Model): """ Describes an instance reuse policy for a warm pool. For more information, see `Warm pools for Amazon EC2 Auto Scaling <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ ReuseOnScaleIn: "bool | None" = None """ Specifies whether instances in the Auto Scaling group can be returned to the warm pool on scale in. """
[docs]class AutoScalingWarmPoolConfiguration(Boto3Model): """ Describes a warm pool configuration. """ MaxGroupPreparedCapacity: "int | None" = None """ The maximum number of instances that are allowed to be in the warm pool or in any state except ``Terminated`` for the Auto Scaling group. """ MinSize: "int | None" = None """ The minimum number of instances to maintain in the warm pool. """ PoolState: "Literal['Stopped', 'Running', 'Hibernated'] | None" = None """ The instance state to transition to after the lifecycle actions are complete. """ Status: "Literal['PendingDelete'] | None" = None """ The status of a warm pool that is marked for deletion. """ InstanceReusePolicy: "AutoScalingInstanceReusePolicy | None" = None """ The instance reuse policy. """
[docs]class TrafficSourceIdentifier(Boto3Model): """ Identifying information for a traffic source. """ Identifier: str """ Identifies the traffic source. """ Type: "str | None" = None """ Provides additional context for the value of ``Identifier``. """
[docs]class AutoScalingInstanceMaintenancePolicy(Boto3Model): """ Describes an instance maintenance policy. For more information, see `Set instance maintenance policy <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-maintenance-policy.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ MinHealthyPercentage: "int | None" = None """ Specifies the lower threshold as a percentage of the desired capacity of the Auto Scaling group. It represents the minimum percentage of the group to keep in service, healthy, and ready to use to support your workload when replacing instances. Value range is 0 to 100. To clear a previously set value, specify a value of ``-1``. """ MaxHealthyPercentage: "int | None" = None """ Specifies the upper threshold as a percentage of the desired capacity of the Auto Scaling group. It represents the maximum percentage of the group that can be in service and healthy, or pending, to support your workload when replacing instances. Value range is 100 to 200. To clear a previously set value, specify a value of ``-1``. """
[docs]class AutoScalingAvailabilityZoneDistribution(Boto3Model): """ Describes an Availability Zone distribution. """ CapacityDistributionStrategy: "Literal['balanced-only', 'balanced-best-effort'] | None" = None """ If launches fail in an Availability Zone, the following strategies are available. The default is ``balanced-best- effort``. """
[docs]class AutoScalingAvailabilityZoneImpairmentPolicy(Boto3Model): """ Describes an Availability Zone impairment policy. """ ZonalShiftEnabled: "bool | None" = None """ If ``true``, enable zonal shift for your Auto Scaling group. """ ImpairedZoneHealthCheckBehavior: "Literal['ReplaceUnhealthy', 'IgnoreUnhealthy'] | None" = None """ Specifies the health check behavior for the impaired Availability Zone in an active zonal shift. If you select ``Replace unhealthy``, instances that appear unhealthy will be replaced in all Availability Zones. If you select ``Ignore unhealthy``, instances will not be replaced in the Availability Zone with the active zonal shift. For more information, see `Auto Scaling group zonal shift <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-zonal- shift.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """
[docs]class AutoScalingCapacityReservationTarget(Boto3Model): """ The target for the Capacity Reservation. Specify Capacity Reservations IDs or Capacity Reservation resource group ARNs. """ CapacityReservationIds: "builtins.list[str] | None" = Field(default_factory=list) """ The Capacity Reservation IDs to launch instances into. """ CapacityReservationResourceGroupArns: "builtins.list[str] | None" = Field( default_factory=list ) """ The resource group ARNs of the Capacity Reservation to launch instances into. """
[docs]class AutoScalingCapacityReservationSpecification(Boto3Model): """ Describes the Capacity Reservation preference and targeting options. If you specify ``open`` or ``none`` for ``CapacityReservationPreference``, do not specify a ``CapacityReservationTarget``. """ CapacityReservationPreference: "Literal['capacity-reservations-only', 'capacity-reservations-first', 'none', 'default'] | None" = None """ The capacity reservation preference. The following options are available: """ CapacityReservationTarget: "AutoScalingCapacityReservationTarget | None" = None """ Describes a target Capacity Reservation or Capacity Reservation resource group. """
[docs]class AutoScalingRetentionTriggers(Boto3Model): """ Defines the specific triggers that cause instances to be retained in a Retained state rather than terminated. Each trigger corresponds to a different failure scenario during the instance lifecycle. This allows fine-grained control over when to preserve instances for manual intervention. """ TerminateHookAbandon: "Literal['retain', 'terminate'] | None" = None """ Specifies the action when a termination lifecycle hook is abandoned due to failure, timeout, or explicit abandonment (calling CompleteLifecycleAction). """
[docs]class AutoScalingInstanceLifecyclePolicy(Boto3Model): """ The instance lifecycle policy for the Auto Scaling group. This policy controls instance behavior when an instance transitions through its lifecycle states. Configure retention triggers to specify when instances should move to a ``Retained`` state instead of automatic termination. For more information, see `Control instance retention with instance lifecycle policies <https://docs.aws.amazon.com/autoscaling/ec2/userguide/instance-lifecycle-policy.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ RetentionTriggers: "AutoScalingRetentionTriggers | None" = None """ Specifies the conditions that trigger instance retention behavior. These triggers determine when instances should move to a ``Retained`` state instead of automatic termination. This allows you to maintain control over instance management when lifecycles transition and operations fail. """
[docs]class AutoScalingGroup(TagsDictMixin, AutoScalingGroupModelMixin, PrimaryBoto3Model): """ Describes an Auto Scaling group. """ tag_class: ClassVar[type[Boto3Model]] = AutoScalingTagDescription manager_class: ClassVar[type[Boto3ModelManager]] = AutoScalingGroupManager DefaultCooldown: "int | None" = 300 """ The duration of the default cooldown period, in seconds, for the Auto Scaling group. """ AutoScalingGroupName: str """ The name of the Auto Scaling group. """ AutoScalingGroupARN: str = Field(default=None, frozen=True) """ The Amazon Resource Name (ARN) of the Auto Scaling group. """ LaunchConfigurationName: "str | None" = None """ The name of the associated launch configuration for the Auto Scaling group. """ LaunchTemplate: "AutoScalingLaunchTemplateSpecification | None" = None """ The launch template for the Auto Scaling group. """ MixedInstancesPolicy: "AutoScalingMixedInstancesPolicy | None" = None """ The mixed instances policy for the group. """ MinSize: int """ The minimum size of the Auto Scaling group. """ MaxSize: int """ The maximum size of the Auto Scaling group. """ DesiredCapacity: int """ The desired size of the Auto Scaling group. """ PredictedCapacity: int = Field(default=None, frozen=True) """ The predicted capacity of the group when it has a predictive scaling policy. """ AvailabilityZones: "builtins.list[str]" """ One or more Availability Zones for the Auto Scaling group. """ AvailabilityZoneIds: "builtins.list[str] | None" = Field(default_factory=list) """ The Availability Zone IDs where the Auto Scaling group can launch instances. """ LoadBalancerNames: "builtins.list[str] | None" = Field(default_factory=list) """ One or more load balancers associated with the group. """ TargetGroupARNs: "builtins.list[str] | None" = Field(default_factory=list) """ The Amazon Resource Names (ARN) of the target groups for your load balancer. """ HealthCheckType: str """ One or more comma-separated health check types for the Auto Scaling group. """ HealthCheckGracePeriod: "int | None" = None """ The duration of the health check grace period, in seconds, for the Auto Scaling group. """ Instances: "builtins.list[AutoScalingInstanceReference]" = Field( default_factory=list, frozen=True ) """ The EC2 instances associated with the Auto Scaling group. """ CreatedTime: datetime = Field(frozen=True) """ The date and time the Auto Scaling group was created. """ SuspendedProcesses: "builtins.list[SuspendedProcess]" = Field( default_factory=list, frozen=True ) """ The suspended processes associated with the Auto Scaling group. """ PlacementGroup: "str | None" = None """ The name of the placement group into which to launch EC2 instances for the Auto Scaling group. """ VPCZoneIdentifier: "str | None" = None """ One or more comma-separated subnet IDs for the Auto Scaling group. """ EnabledMetrics: "builtins.list[EnabledMetric]" = Field( default_factory=list, frozen=True ) """ The metrics enabled for the Auto Scaling group. """ Status: str = Field(default=None, frozen=True) """ The current state of the Auto Scaling group when the `DeleteAutoScalingGroup <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DeleteAutoScalingGroup.html>`_ operation is in progress. """ Tags: "builtins.list[AutoScalingTagDescription] | None" = Field( default_factory=list ) """ The tags for the Auto Scaling group. """ TerminationPolicies: "builtins.list[str] | None" = Field(default_factory=list) """ The termination policies for the Auto Scaling group. """ NewInstancesProtectedFromScaleIn: "bool | None" = None """ Indicates whether newly launched EC2 instances are protected from termination when scaling in for the Auto Scaling group. """ ServiceLinkedRoleARN: "str | None" = None """ The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other Amazon Web Services on your behalf. """ MaxInstanceLifetime: "int | None" = None """ The maximum amount of time, in seconds, that an EC2 instance can be in service for the Auto Scaling group. """ CapacityRebalance: "bool | None" = None """ Indicates whether Capacity Rebalancing is enabled. """ WarmPoolConfiguration: AutoScalingWarmPoolConfiguration = Field( default=None, frozen=True ) """ The warm pool for the group. """ WarmPoolSize: int = Field(default=None, frozen=True) """ The current size of the warm pool. """ Context: "str | None" = None """ Reserved. """ DesiredCapacityType: "str | None" = None """ The unit of measurement for the value specified for desired capacity. Amazon EC2 Auto Scaling supports ``DesiredCapacityType`` for attribute-based instance type selection only. """ DefaultInstanceWarmup: "int | None" = None """ The duration of the default EC2 instance warmup time, in seconds, for the Auto Scaling group. """ TrafficSources: "builtins.list[TrafficSourceIdentifier] | None" = Field( default_factory=list ) """ The traffic sources associated with this Auto Scaling group. """ InstanceMaintenancePolicy: "AutoScalingInstanceMaintenancePolicy | None" = None """ An instance maintenance policy. """ DeletionProtection: "Literal['none', 'prevent-force-deletion', 'prevent-all-deletion'] | None" = None """ The deletion protection setting for the Auto Scaling group. """ AvailabilityZoneDistribution: "AutoScalingAvailabilityZoneDistribution | None" = ( None ) """ The EC2 instance capacity distribution across Availability Zones for the Auto Scaling group. """ AvailabilityZoneImpairmentPolicy: "AutoScalingAvailabilityZoneImpairmentPolicy | None" = None """ The Availability Zone impairment policy for the Auto Scaling group. """ CapacityReservationSpecification: "AutoScalingCapacityReservationSpecification | None" = None """ The capacity reservation specification for the Auto Scaling group. """ InstanceLifecyclePolicy: "AutoScalingInstanceLifecyclePolicy | None" = None """ The instance lifecycle policy for the Auto Scaling group. """ @property def pk(self) -> str | None: """ Return the primary key of the model. This is the value of the :py:attr:`AutoScalingGroupName` attribute. Returns: The primary key of the model instance. """ return self.AutoScalingGroupName @property def arn(self) -> str | None: """ Return the ARN of the model. This is the value of the :py:attr:`AutoScalingGroupARN` attribute. Returns: The ARN of the model instance. """ return self.AutoScalingGroupARN @property def name(self) -> str | None: """ Return the name of the model. This is the value of the :py:attr:`AutoScalingGroupName` attribute. Returns: The name of the model instance. """ return self.AutoScalingGroupName def __hash__(self) -> int: """ Return the hash of the model. This is the value of the :py:attr:`AutoScalingGroupName` attribute. """ return hash(self.AutoScalingGroupName) @cached_property def launch_configuration(self) -> "LaunchConfiguration | None": """ Return the :py:class:`LaunchConfiguration` object that this group uses, if any. .. note:: The output of this property is cached on the model instance, so calling this multiple times will not result in multiple calls to the AWS API. If you need a fresh copy of the data, you can re-get the model instance from the manager. """ try: pk = OrderedDict( { "LaunchConfigurationName": self.LaunchConfigurationName, } ) except AttributeError: return None return LaunchConfiguration.objects.using(self.session).get(**pk) # type: ignore[arg-type] @cached_property def launch_template(self) -> "LaunchTemplateVersion | None": """ Return the :py:class:`LaunchTemplate` object that this group uses, if any. .. note:: The output of this property is cached on the model instance, so calling this multiple times will not result in multiple calls to the AWS API. If you need a fresh copy of the data, you can re-get the model instance from the manager. """ try: pk = OrderedDict( { "LaunchTemplateId": self.LaunchTemplate.LaunchTemplateId, "Version": self.LaunchTemplate.Version, } ) except AttributeError: return None return LaunchTemplateVersion.objects.using(self.session).get(**pk) # type: ignore[arg-type]
[docs]class EbsMapping(Boto3Model): """ Describes information used to set up an Amazon EBS volume specified in a block device mapping. """ SnapshotId: "str | None" = None """ The snapshot ID of the volume to use. """ VolumeSize: "int | None" = None """ The volume size, in GiBs. The following are the supported volumes sizes for each volume type: """ VolumeType: "str | None" = None """ The volume type. For more information, see `Amazon EBS volume types <https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volume-types.html>`_ in the *Amazon EBS User Guide*. """ DeleteOnTermination: "bool | None" = None """ Indicates whether the volume is deleted on instance termination. For Amazon EC2 Auto Scaling, the default value is ``true``. """ Iops: "int | None" = None """ The number of input/output (I/O) operations per second (IOPS) to provision for the volume. For ``gp3`` and ``io1`` volumes, this represents the number of IOPS that are provisioned for the volume. For ``gp2`` volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. """ Encrypted: "bool | None" = None """ Specifies whether the volume should be encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see `Requirements for Amazon EBS encryption <https://docs.aws.amazon.com/ebs/latest/userguide/ebs-encryption-requirements.html>`_ in the *Amazon EBS User Guide*. If your AMI uses encrypted volumes, you can also only launch it on supported instance types. """ Throughput: "int | None" = None """ The throughput (MiBps) to provision for a ``gp3`` volume. """
[docs]class AutoScalingBlockDeviceMapping(Boto3Model): """ Describes a block device mapping. """ VirtualName: "str | None" = None """ The name of the instance store volume (virtual device) to attach to an instance at launch. The name must be in the form ephemeral*X* where *X* is a number starting from zero (0), for example, ``ephemeral0``. """ DeviceName: str """ The device name assigned to the volume (for example, ``/dev/sdh`` or ``xvdh``). For more information, see `Device naming on Linux instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html>`_ in the *Amazon EC2 User Guide*. """ Ebs: "EbsMapping | None" = None """ Information to attach an EBS volume to an instance at launch. """ NoDevice: "bool | None" = None """ Setting this value to ``true`` prevents a volume that is included in the block device mapping of the AMI from being mapped to the specified device name at launch. """
[docs]class AutoScalingInstanceMonitoring(Boto3Model): """ Describes whether detailed monitoring is enabled for the Auto Scaling instances. """ Enabled: "bool | None" = None """ If ``true``, detailed monitoring is enabled. Otherwise, basic monitoring is enabled. """
[docs]class InstanceMetadataOptions(Boto3Model): """ The metadata options for the instances. For more information, see `Configure the instance metadata options <https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ HttpTokens: "Literal['optional', 'required'] | None" = None """ The state of token usage for your instance metadata requests. If the parameter is not specified in the request, the default state is ``optional``. """ HttpPutResponseHopLimit: "int | None" = None """ The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. """ HttpEndpoint: "Literal['disabled', 'enabled'] | None" = None """ This parameter enables or disables the HTTP metadata endpoint on your instances. If the parameter is not specified, the default state is ``enabled``. """
[docs]class LaunchConfiguration(PrimaryBoto3Model): """ Describes a launch configuration. """ manager_class: ClassVar[type[Boto3ModelManager]] = LaunchConfigurationManager LaunchConfigurationName: str """ The name of the launch configuration. """ LaunchConfigurationARN: str = Field(default=None, frozen=True) """ The Amazon Resource Name (ARN) of the launch configuration. """ ImageId: str """ The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances. For more information, see `Find a Linux AMI <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html>`_ in the *Amazon EC2 User Guide*. """ KeyName: "str | None" = None """ The name of the key pair. """ SecurityGroups: "builtins.list[str] | None" = Field(default_factory=list) """ A list that contains the security groups to assign to the instances in the Auto Scaling group. For more information, see `Control traffic to your Amazon Web Services resources using security groups <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html>`_ in the *Amazon Virtual Private Cloud User Guide*. """ ClassicLinkVPCId: "str | None" = None """ Available for backward compatibility. """ ClassicLinkVPCSecurityGroups: "builtins.list[str] | None" = Field( default_factory=list ) """ Available for backward compatibility. """ UserData: "str | None" = None """ The user data to make available to the launched EC2 instances. For more information, see `Instance metadata and user data <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html>`_ in the *Amazon EC2 User Guide*. If you are using a command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. User data is limited to 16 KB. """ InstanceType: str """ The instance type for the instances. For information about available instance types, see `Available instance types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes>`_ in the *Amazon EC2 User Guide*. """ KernelId: "str | None" = None """ The ID of the kernel associated with the AMI. """ RamdiskId: "str | None" = None """ The ID of the RAM disk associated with the AMI. """ BlockDeviceMappings: "builtins.list[AutoScalingBlockDeviceMapping] | None" = Field( default_factory=list ) """ The block device mapping entries that define the block devices to attach to the instances at launch. By default, the block devices specified in the block device mapping for the AMI are used. For more information, see `Block device mappings <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html>`_ in the *Amazon EC2 User Guide*. """ InstanceMonitoring: "AutoScalingInstanceMonitoring | None" = None """ Controls whether instances in this group are launched with detailed (``true``) or basic (``false``) monitoring. """ SpotPrice: "str | None" = None """ The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see `Requesting Spot Instances for fault-tolerant and flexible applications <https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-template-spot- instances.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ IamInstanceProfile: "str | None" = None """ The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. The instance profile contains the IAM role. For more information, see `IAM role for applications that run on Amazon EC2 instances <https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ CreatedTime: datetime = Field(frozen=True) """ The creation date and time for the launch configuration. """ EbsOptimized: "bool | None" = None """ Specifies whether the launch configuration is optimized for EBS I/O (``true``) or not (``false``). For more information, see `Amazon EBS-optimized instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html>`_ in the *Amazon EC2 User Guide*. """ AssociatePublicIpAddress: "bool | None" = None """ Specifies whether to assign a public IPv4 address to the group's instances. If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet. For more information, see `Provide network connectivity for your Auto Scaling instances using Amazon VPC <https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ PlacementTenancy: "str | None" = None """ The tenancy of the instance, either ``default`` or ``dedicated``. An instance with ``dedicated`` tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. """ MetadataOptions: "InstanceMetadataOptions | None" = None """ The metadata options for the instances. For more information, see `Configure the instance metadata options <https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ @property def pk(self) -> str | None: """ Return the primary key of the model. This is the value of the :py:attr:`LaunchConfigurationName` attribute. Returns: The primary key of the model instance. """ return self.LaunchConfigurationName @property def arn(self) -> str | None: """ Return the ARN of the model. This is the value of the :py:attr:`LaunchConfigurationARN` attribute. Returns: The ARN of the model instance. """ return self.LaunchConfigurationARN @property def name(self) -> str | None: """ Return the name of the model. This is the value of the :py:attr:`LaunchConfigurationName` attribute. Returns: The name of the model instance. """ return self.LaunchConfigurationName def __hash__(self) -> int: """ Return the hash of the model. This is the value of the :py:attr:`LaunchConfigurationName` attribute. """ return hash(self.LaunchConfigurationName) @cached_property def security_groups(self) -> "list[SecurityGroup] | None": """ Return the security groups that this launch configuration uses. .. note:: The output of this property is cached on the model instance, so calling this multiple times will not result in multiple calls to the AWS API. If you need a fresh copy of the data, you can re-get the model instance from the manager. """ try: pk = OrderedDict( { "SecurityGroups": self.SecurityGroups, } ) except AttributeError: return [] return SecurityGroup.objects.using(self.session).list(**pk) # type: ignore[arg-type] @cached_property def ami(self) -> "AMI | None": """ Return the :py:class:`AMI` object that this launch configuration uses. .. note:: The output of this property is cached on the model instance, so calling this multiple times will not result in multiple calls to the AWS API. If you need a fresh copy of the data, you can re-get the model instance from the manager. """ try: pk = OrderedDict( { "ImageId": self.ImageId, } ) except AttributeError: return None return AMI.objects.using(self.session).get(**pk) # type: ignore[arg-type] @cached_property def instance_type(self) -> "EC2InstanceType | None": """ Return the :py:class:`EC2InstanceType` object that this launch configuration uses. .. note:: The output of this property is cached on the model instance, so calling this multiple times will not result in multiple calls to the AWS API. If you need a fresh copy of the data, you can re-get the model instance from the manager. """ try: pk = OrderedDict( { "InstanceType": self.InstanceType, } ) except AttributeError: return None return EC2InstanceType.objects.using(self.session).get(**pk) # type: ignore[arg-type]
# ======================= # Request/Response Models # =======================
[docs]class LifecycleHookSpecification(Boto3Model): """ Describes information used to specify a lifecycle hook for an Auto Scaling group. For more information, see `Amazon EC2 Auto Scaling lifecycle hooks <https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ LifecycleHookName: str """ The name of the lifecycle hook. """ LifecycleTransition: str """ The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions. """ NotificationMetadata: "str | None" = None """ Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target. """ HeartbeatTimeout: "int | None" = None """ The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from ``30`` to ``7200`` seconds. The default value is ``3600`` seconds (1 hour). """ DefaultResult: "str | None" = None """ The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is ``ABANDON``. """ NotificationTargetARN: "str | None" = None """ The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS queue. """ RoleARN: "str | None" = None """ The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. For information about creating this role, see `Prepare to add a lifecycle hook to your Auto Scaling group <https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """
[docs]class AutoScalingGroupsType(Boto3Model): AutoScalingGroups: "builtins.list[AutoScalingGroup]" """ The groups. """ NextToken: "str | None" = None """ A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the ``NextToken`` value when requesting the next set of items. This value is null when there are no more items to return. """
[docs]class AutoScalingInstanceDetails(Boto3Model): """ Describes an EC2 instance associated with an Auto Scaling group. """ InstanceId: str """ The ID of the instance. """ InstanceType: "str | None" = None """ The instance type of the EC2 instance. """ AutoScalingGroupName: str """ The name of the Auto Scaling group for the instance. """ AvailabilityZone: str """ The Availability Zone for the instance. """ AvailabilityZoneId: "str | None" = None """ The Availability Zone ID where the instance is located. """ LifecycleState: str """ The lifecycle state for the instance. The ``Quarantined`` state is not used. For more information, see `Amazon EC2 Auto Scaling instance lifecycle <https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-lifecycle.html>`_ in the *Amazon EC2 Auto Scaling User Guide*. """ HealthStatus: str """ The last reported health status of this instance. ``Healthy`` means that the instance is healthy and should remain in service. ``Unhealthy`` means that the instance is unhealthy and Amazon EC2 Auto Scaling should terminate and replace it. """ LaunchConfigurationName: "str | None" = None """ The launch configuration used to launch the instance. This value is not available if you attached the instance to the Auto Scaling group. """ LaunchTemplate: "AutoScalingLaunchTemplateSpecification | None" = None """ The launch template for the instance. """ ImageId: "str | None" = None """ The ID of the Amazon Machine Image (AMI) associated with the instance. This field shows the current AMI ID of the instance's root volume. It may differ from the original AMI used when the instance was first launched. """ ProtectedFromScaleIn: bool """ Indicates whether the instance is protected from termination by Amazon EC2 Auto Scaling when scaling in. """ WeightedCapacity: "str | None" = None """ The number of capacity units contributed by the instance based on its instance type. """
[docs]class AutoScalingInstancesType(Boto3Model): AutoScalingInstances: "builtins.list[AutoScalingInstanceDetails] | None" = Field( default_factory=list ) """ The instances. """ NextToken: "str | None" = None """ A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the ``NextToken`` value when requesting the next set of items. This value is null when there are no more items to return. """
[docs]class AutoScalingActivity(Boto3Model): """ Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance. """ ActivityId: str """ The ID of the activity. """ AutoScalingGroupName: str """ The name of the Auto Scaling group. """ Description: "str | None" = None """ A friendly, more verbose description of the activity. """ Cause: str """ The reason the activity began. """ StartTime: datetime """ The start time of the activity. """ EndTime: "datetime | None" = None """ The end time of the activity. """ StatusCode: Literal[ "PendingSpotBidPlacement", "WaitingForSpotInstanceRequestId", "WaitingForSpotInstanceId", "WaitingForInstanceId", "PreInService", "InProgress", "WaitingForELBConnectionDraining", "MidLifecycleAction", "WaitingForInstanceWarmup", "Successful", "Failed", "Cancelled", "WaitingForConnectionDraining", "WaitingForInPlaceUpdateToStart", "WaitingForInPlaceUpdateToFinalize", "InPlaceUpdateInProgress", ] """ The current status of the activity. """ StatusMessage: "str | None" = None """ A friendly, more verbose description of the activity status. """ Progress: "int | None" = None """ A value between 0 and 100 that indicates the progress of the activity. """ Details: "str | None" = None """ The details about the activity. """ AutoScalingGroupState: "str | None" = None """ The state of the Auto Scaling group, which is either ``InService`` or ``Deleted``. """ AutoScalingGroupARN: "str | None" = None """ The Amazon Resource Name (ARN) of the Auto Scaling group. """
[docs]class ActivityType(Boto3Model): Activity: "AutoScalingActivity | None" = None """ A scaling activity. """
[docs]class LaunchConfigurationsType(Boto3Model): LaunchConfigurations: "builtins.list[LaunchConfiguration]" """ The launch configurations. """ NextToken: "str | None" = None """ A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the ``NextToken`` value when requesting the next set of items. This value is null when there are no more items to return. """