# This file is automatically generated by botocraft.  Do not edit directly.
# mypy: disable-error-code="index, override, assignment, union-attr, misc"
from botocraft.services.common import Filter
from botocraft.mixins.tags import TagsDictMixin
from collections import OrderedDict
from botocraft.mixins.ec2 import InstanceModelMixin
from typing import ClassVar, Type, Optional, Literal, Dict, List, Union, Any, cast
from botocraft.mixins.ec2 import EC2TagsManagerMixin
from datetime import datetime
from botocraft.services.common import Tag
from pydantic import Field
from botocraft.mixins.ec2 import AMIModelMixin
from botocraft.mixins.ec2 import ec2_instances_only
from botocraft.mixins.ec2 import AMIManagerMixin
from botocraft.mixins.ec2 import SubnetModelMixin
from botocraft.mixins.ec2 import SecurityGroupModelMixin
from .abstract import PrimaryBoto3ModelQuerySet
from botocraft.mixins.ec2 import ec2_instance_only
from botocraft.mixins.ec2 import VpcModelMixin
from .abstract import (
    Boto3Model,
    ReadonlyBoto3Model,
    PrimaryBoto3Model,
    ReadonlyPrimaryBoto3Model,
    Boto3ModelManager,
    ReadonlyBoto3ModelManager,
)
from functools import cached_property

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


class VpcManager(ReadonlyBoto3ModelManager):
    service_name: str = "ec2"

    def get(self, VpcId: str, *, DryRun: bool = False) -> Optional["Vpc"]:
        """
        Describes your VPCs. The default is to describe all your VPCs. Alternatively,
        you can specify specific VPC IDs or filter the results to include only the VPCs
        that match specific criteria.

        Args:
            VpcId: The name of the VPC to describe.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            VpcIds=self.serialize([VpcId]), DryRun=self.serialize(DryRun)
        )
        _response = self.client.describe_vpcs(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeVpcsResult(**_response)

        if response and response.Vpcs:
            self.sessionize(response.Vpcs[0])
            return response.Vpcs[0]
        return None

    def list(
        self,
        *,
        Filters: List[Filter] | None = None,
        VpcIds: List[str] | None = None,
        DryRun: bool | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes your VPCs. The default is to describe all your VPCs. Alternatively,
        you can specify specific VPC IDs or filter the results to include only the VPCs
        that match specific criteria.

        Keyword Args:
            Filters: The filters.
            VpcIds: The IDs of the VPCs.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        paginator = self.client.get_paginator("describe_vpcs")
        args: Dict[str, Any] = dict(
            Filters=self.serialize(Filters),
            VpcIds=self.serialize(VpcIds),
            DryRun=self.serialize(DryRun),
        )
        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 = DescribeVpcsResult(**_response)
            if response.Vpcs:
                results.extend(response.Vpcs)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results

    def dns_hostnames(self, VpcId: str) -> bool:
        """
        Describes the specified attribute of the specified VPC. You can specify only one
        attribute at a time.

        Args:
            VpcId: The ID of the VPC.
        """
        args: Dict[str, Any] = dict(
            Attribute="enableDnsHostnames", VpcId=self.serialize(VpcId), DryRun=False
        )
        _response = self.client.describe_vpc_attribute(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeVpcAttributeResult(**_response)

        results: bool = None
        if response is not None:
            results = response.EnableDnsHostnames["Value"]

        self.sessionize(results)
        return cast("bool", results)

    def dns_support(self, VpcId: str) -> bool:
        """
        Describes the specified attribute of the specified VPC. You can specify only one
        attribute at a time.

        Args:
            VpcId: The ID of the VPC.
        """
        args: Dict[str, Any] = dict(
            Attribute="enableDnsSupport", VpcId=self.serialize(VpcId), DryRun=False
        )
        _response = self.client.describe_vpc_attribute(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeVpcAttributeResult(**_response)

        results: bool = None
        if response is not None:
            results = response.EnableDnsSupport["Value"]

        self.sessionize(results)
        return cast("bool", results)

    def network_address_usage_metrics(self, VpcId: str) -> bool:
        """
        Describes the specified attribute of the specified VPC. You can specify only one
        attribute at a time.

        Args:
            VpcId: The ID of the VPC.
        """
        args: Dict[str, Any] = dict(
            Attribute="enableNetworkAddressUsageMetrics",
            VpcId=self.serialize(VpcId),
            DryRun=False,
        )
        _response = self.client.describe_vpc_attribute(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeVpcAttributeResult(**_response)

        results: bool = None
        if response is not None:
            results = response.EnableNetworkAddressUsageMetrics["Value"]

        self.sessionize(results)
        return cast("bool", results)


class SubnetManager(ReadonlyBoto3ModelManager):
    service_name: str = "ec2"

    def get(self, SubnetId: str, *, DryRun: bool = False) -> Optional["Subnet"]:
        """
        Describes your subnets. The default is to describe all your subnets.
        Alternatively, you can specify specific subnet IDs or filter the results to
        include only the subnets that match specific criteria.

        Args:
            SubnetId: The ID of the VPC subnet to describe.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            SubnetIds=self.serialize([SubnetId]), DryRun=self.serialize(DryRun)
        )
        _response = self.client.describe_subnets(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeSubnetsResult(**_response)

        if response and response.Subnets:
            self.sessionize(response.Subnets[0])
            return response.Subnets[0]
        return None

    def list(
        self,
        *,
        Filters: List[Filter] | None = None,
        SubnetIds: List[str] | None = None,
        DryRun: bool | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes your subnets. The default is to describe all your subnets.
        Alternatively, you can specify specific subnet IDs or filter the results to
        include only the subnets that match specific criteria.

        Keyword Args:
            Filters: The filters.
            SubnetIds: The IDs of the subnets.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        paginator = self.client.get_paginator("describe_subnets")
        args: Dict[str, Any] = dict(
            Filters=self.serialize(Filters),
            SubnetIds=self.serialize(SubnetIds),
            DryRun=self.serialize(DryRun),
        )
        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 = DescribeSubnetsResult(**_response)
            if response.Subnets:
                results.extend(response.Subnets)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results


class SecurityGroupManager(EC2TagsManagerMixin, Boto3ModelManager):
    service_name: str = "ec2"

    def create(self, model: "SecurityGroup", DryRun: bool = False) -> str:
        """
        Creates a security group.

        Args:
            model: The :py:class:`SecurityGroup` to create.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            Description=data.get("Description"),
            GroupName=data.get("GroupName"),
            VpcId=data.get("VpcId"),
            TagSpecifications=self.serialize(
                self.serialize(self.convert_tags(model.Tags, "security-group"))
            ),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.create_security_group(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateSecurityGroupResult(**_response)

        self.sessionize(response.GroupId)
        return cast("str", response.GroupId)

    def delete(self, GroupId: str, *, DryRun: bool = False) -> "SecurityGroup":
        """
        Deletes a security group.

        Args:
            GroupId: The ID of the security group.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            GroupId=self.serialize(GroupId), DryRun=self.serialize(DryRun)
        )
        _response = self.client.delete_security_group(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DeleteSecurityGroupResult(**_response)
        return response

    def get(self, GroupId: str, *, DryRun: bool = False) -> Optional["SecurityGroup"]:
        """
        Describes the specified security groups or all of your security groups.

        Args:
            GroupId: The ID of the security group.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            GroupIds=self.serialize([GroupId]), DryRun=self.serialize(DryRun)
        )
        _response = self.client.describe_security_groups(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeSecurityGroupsResult(**_response)

        if response and response.SecurityGroups:
            self.sessionize(response.SecurityGroups[0])
            return response.SecurityGroups[0]
        return None

    def list(
        self,
        *,
        GroupIds: List[str] | None = None,
        GroupNames: List[str] | None = None,
        DryRun: bool = False,
        Filters: List[Filter] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes the specified security groups or all of your security groups.

        Keyword Args:
            GroupIds: The IDs of the security groups. Required for security groups in a nondefault VPC.
            GroupNames: [Default VPC] The names of the security groups. You can specify either the security group name or the
                security group ID.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            Filters: The filters. If using multiple filters for rules, the results include security groups for which any
                combination of rules - not necessarily a single rule - match all filters.
        """
        paginator = self.client.get_paginator("describe_security_groups")
        args: Dict[str, Any] = dict(
            GroupIds=self.serialize(GroupIds),
            GroupNames=self.serialize(GroupNames),
            DryRun=self.serialize(DryRun),
            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 = DescribeSecurityGroupsResult(**_response)
            if response.SecurityGroups:
                results.extend(response.SecurityGroups)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results

    def revoke_ingress(
        self, GroupId: str, IpPermissions: List["IpPermission"], *, DryRun: bool = False
    ) -> bool | None:
        """
        Removes the specified inbound (ingress) rules from a security group.

        Args:
            GroupId: The ID of the security group.
            IpPermissions: The sets of IP permissions. You can't specify a source security group and a CIDR IP address range in
                the same set of permissions.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            GroupId=self.serialize(GroupId),
            IpPermissions=self.serialize(IpPermissions),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.revoke_security_group_ingress(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = RevokeSecurityGroupIngressResult(**_response)

        results: bool | None = None
        if response is not None:
            results = response.Return

        self.sessionize(results)
        return cast("bool | None", results)

    def authorize_ingress(
        self,
        GroupId: str,
        IpPermissions: List["IpPermission"],
        *,
        Tags: List["Tag"] | None = None,
        DryRun: bool = False,
    ) -> bool | None:
        """
        Adds the specified inbound (ingress) rules to a security group.

        Args:
            GroupId: The ID of the security group.
            IpPermissions: The permissions for the security group rules.

        Keyword Args:
            Tags: The tags applied to the security group rule.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            GroupId=self.serialize(GroupId),
            IpPermissions=self.serialize(IpPermissions),
            TagSpecifications=self.serialize(
                self.serialize(self.convert_tags(Tags, "security-group-rule"))
            ),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.authorize_security_group_ingress(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = AuthorizeSecurityGroupIngressResult(**_response)

        results: bool | None = None
        if response is not None:
            results = response.Return

        self.sessionize(results)
        return cast("bool | None", results)


class NetworkAclManager(EC2TagsManagerMixin, Boto3ModelManager):
    service_name: str = "ec2"

    def create(
        self, model: "NetworkAcl", ClientToken: str | None = None
    ) -> "NetworkAcl":
        """
        Creates a network ACL in a VPC. Network ACLs provide an optional layer of
        security (in addition to security groups) for the instances in your VPC.

        Args:
            model: The :py:class:`NetworkAcl` to create.

        Keyword Args:
            ClientToken: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
                information, see `Ensuring idempotency <https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html>`_.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            VpcId=data.get("VpcId"),
            TagSpecifications=self.serialize(
                self.serialize(self.convert_tags(model.Tags, "network-acl"))
            ),
            ClientToken=self.serialize(ClientToken),
            DryRun=data.get("DryRun"),
        )
        _response = self.client.create_network_acl(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateNetworkAclResult(**_response)

        self.sessionize(response.NetworkAclInstance)
        return cast("NetworkAcl", response.NetworkAclInstance)

    def delete(self, NetworkAclId: str, *, DryRun: bool = False) -> None:
        """
        Deletes the specified network ACL. You can't delete the ACL if it's associated
        with any subnets. You can't delete the default network ACL.

        Args:
            NetworkAclId: The ID of the network ACL.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            NetworkAclId=self.serialize(NetworkAclId), DryRun=self.serialize(DryRun)
        )
        self.client.delete_network_acl(
            **{k: v for k, v in args.items() if v is not None}
        )

    def get(self, NetworkAclId: str, *, DryRun: bool = False) -> Optional["NetworkAcl"]:
        """
        Describes your network ACLs. The default is to describe all your network ACLs.
        Alternatively, you can specify specific network ACL IDs or filter the results to
        include only the network ACLs that match specific criteria.

        Args:
            NetworkAclId: The ID of the network ACL.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun), NetworkAclIds=self.serialize([NetworkAclId])
        )
        _response = self.client.describe_network_acls(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeNetworkAclsResult(**_response)

        if response and response.NetworkAcls:
            self.sessionize(response.NetworkAcls[0])
            return response.NetworkAcls[0]
        return None

    def list(
        self,
        *,
        DryRun: bool = False,
        NetworkAclIds: List[str] | None = None,
        Filters: List[Filter] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes your network ACLs. The default is to describe all your network ACLs.
        Alternatively, you can specify specific network ACL IDs or filter the results to
        include only the network ACLs that match specific criteria.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            NetworkAclIds: The IDs of the network ACLs.
            Filters: The filters.
        """
        paginator = self.client.get_paginator("describe_network_acls")
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            NetworkAclIds=self.serialize(NetworkAclIds),
            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 = DescribeNetworkAclsResult(**_response)
            if response.NetworkAcls:
                results.extend(response.NetworkAcls)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results


class AMIManager(EC2TagsManagerMixin, AMIManagerMixin, Boto3ModelManager):
    service_name: str = "ec2"

    def create(
        self,
        model: "AMI",
        SnapshotLocation: Literal["regional", "local"] | None = None,
        NoReboot: bool | None = None,
    ) -> str:
        """
        Creates an Amazon EBS-backed AMI from an Amazon EBS-backed instance that is
        either running or stopped.

        Args:
            model: The :py:class:`Image` to create.

        Keyword Args:
            SnapshotLocation: Only supported for instances in Local Zones. If the source instance is not in a Local Zone, omit
                this parameter.
            NoReboot: Indicates whether or not the instance should be automatically rebooted before creating the image. Specify
                one of the following values:
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            InstanceId=data.get("InstanceId"),
            Name=data.get("Name"),
            TagSpecifications=self.serialize(
                self.serialize(self.convert_tags(model.Tags, "image"))
            ),
            SnapshotLocation=self.serialize(SnapshotLocation),
            DryRun=data.get("DryRun"),
            Description=data.get("Description"),
            NoReboot=self.serialize(NoReboot),
            BlockDeviceMappings=data.get("BlockDeviceMappings"),
        )
        _response = self.client.create_image(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateImageResult(**_response)

        self.sessionize(response.ImageId)
        return cast("str", response.ImageId)

    def delete(
        self,
        ImageId: str,
        *,
        DeleteAssociatedSnapshots: bool | None = None,
        DryRun: bool = False,
    ) -> "AMI":
        """
        Deregisters the specified AMI. A deregistered AMI can't be used to launch new
        instances.

        Args:
            ImageId: The ID of the AMI.

        Keyword Args:
            DeleteAssociatedSnapshots: Specifies whether to delete the snapshots associated with the AMI during deregistration.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            ImageId=self.serialize(ImageId),
            DeleteAssociatedSnapshots=self.serialize(DeleteAssociatedSnapshots),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.deregister_image(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DeregisterImageResult(**_response)
        return response

    def get(
        self,
        ImageId: str,
        *,
        ExecutableUsers: List[str] | None = None,
        Owners: List[str] | None = None,
        IncludeDeprecated: bool | None = None,
        IncludeDisabled: bool | None = None,
        DryRun: bool = False,
    ) -> Optional["AMI"]:
        """
        Describes the specified images (AMIs, AKIs, and ARIs) available to you or all of
        the images available to you.

        Args:
            ImageId: The IDs of the images.

        Keyword Args:
            ExecutableUsers: Scopes the images by users with explicit launch permissions. Specify an Amazon Web Services account
                ID, ``self`` (the sender of the request), or ``all`` (public AMIs).
            Owners: Scopes the results to images with the specified owners. You can specify a combination of Amazon Web Services
                account IDs, ``self``, ``amazon``, ``aws-backup-vault``, and ``aws-marketplace``. If you omit this parameter, the
                results include all images for which you have launch permissions, regardless of ownership.
            IncludeDeprecated: Specifies whether to include deprecated AMIs.
            IncludeDisabled: Specifies whether to include disabled AMIs.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            ExecutableUsers=self.serialize(ExecutableUsers),
            ImageIds=self.serialize([ImageId]),
            Owners=self.serialize(Owners),
            IncludeDeprecated=self.serialize(IncludeDeprecated),
            IncludeDisabled=self.serialize(IncludeDisabled),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.describe_images(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeImagesResult(**_response)

        if response and response.Images:
            self.sessionize(response.Images[0])
            return response.Images[0]
        return None

    def list(
        self,
        *,
        ExecutableUsers: List[str] | None = None,
        ImageIds: List[str] | None = None,
        Owners: List[str] | None = None,
        IncludeDeprecated: bool | None = None,
        IncludeDisabled: bool | None = None,
        DryRun: bool = False,
        Filters: List[Filter] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes the specified images (AMIs, AKIs, and ARIs) available to you or all of
        the images available to you.

        Keyword Args:
            ExecutableUsers: Scopes the images by users with explicit launch permissions. Specify an Amazon Web Services account
                ID, ``self`` (the sender of the request), or ``all`` (public AMIs).
            ImageIds: The image IDs.
            Owners: Scopes the results to images with the specified owners. You can specify a combination of Amazon Web Services
                account IDs, ``self``, ``amazon``, ``aws-backup-vault``, and ``aws-marketplace``. If you omit this parameter, the
                results include all images for which you have launch permissions, regardless of ownership.
            IncludeDeprecated: Specifies whether to include deprecated AMIs.
            IncludeDisabled: Specifies whether to include disabled AMIs.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            Filters: The filters.
        """
        paginator = self.client.get_paginator("describe_images")
        args: Dict[str, Any] = dict(
            ExecutableUsers=self.serialize(ExecutableUsers),
            ImageIds=self.serialize(ImageIds),
            Owners=self.serialize(Owners),
            IncludeDeprecated=self.serialize(IncludeDeprecated),
            IncludeDisabled=self.serialize(IncludeDisabled),
            DryRun=self.serialize(DryRun),
            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 = DescribeImagesResult(**_response)
            if response.Images:
                results.extend(response.Images)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results

    def copy(
        self,
        ClientToken: str,
        Name: str,
        SourceImageId: str,
        SourceRegion: str,
        *,
        Description: str | None = None,
        Encrypted: bool | None = None,
        KmsKeyId: str | None = None,
        DestinationOutpostArn: str | None = None,
        CopyImageTags: bool | None = None,
        TagSpecifications: List["TagSpecification"] | None = None,
        SnapshotCopyCompletionDurationMinutes: int | None = None,
        DestinationAvailabilityZone: str | None = None,
        DestinationAvailabilityZoneId: str | None = None,
        DryRun: bool | None = None,
    ) -> str:
        """
        Initiates an AMI copy operation. You must specify the source AMI ID and both the
        source and destination locations. The copy operation must be initiated in the
        destination Region.

        Args:
            ClientToken: Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more
                information, see `Ensuring idempotency in Amazon EC2 API requests
                <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html>`_ in the *Amazon EC2 API
                Reference*.
            Name: The name of the new AMI.
            SourceImageId: The ID of the AMI to copy.
            SourceRegion: The name of the Region that contains the AMI to copy.

        Keyword Args:
            Description: A description for the new AMI.
            Encrypted: Specifies whether to encrypt the snapshots of the copied image.
            KmsKeyId: The identifier of the symmetric Key Management Service (KMS) KMS key to use when creating encrypted
                volumes. If this parameter is not specified, your Amazon Web Services managed KMS key for Amazon EBS is used. If you
                specify a KMS key, you must also set the encrypted state to ``true``.
            DestinationOutpostArn: The Amazon Resource Name (ARN) of the Outpost for the new AMI.
            CopyImageTags: Specifies whether to copy your user-defined AMI tags to the new AMI.
            TagSpecifications: The tags to apply to the new AMI and new snapshots. You can tag the AMI, the snapshots, or both.
                To tag the new AMI, the value for ````ResourceType```` must be "image" To tag the new snapshots, the value for
                ````ResourceType```` must be "snapshot". The same tag is applied to all the new snapshots.
            SnapshotCopyCompletionDurationMinutes: Specify a completion duration, in 15 minute increments, to initiate a time-
                based AMI copy. The specified completion duration applies to each of the snapshots associated with the AMI. Each
                snapshot associated with the AMI will be completed within the specified completion duration, with copy throughput
                automatically adjusted for each snapshot based on its size to meet the timing target.
            DestinationAvailabilityZone: The Local Zone for the new AMI (for example, ``cn-north-1-pkx-1a``).
            DestinationAvailabilityZoneId: The ID of the Local Zone for the new AMI (for example, ``cnn1-pkx1-az1``).
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            Name=self.serialize(Name),
            SourceImageId=self.serialize(SourceImageId),
            SourceRegion=self.serialize(SourceRegion),
            ClientToken=self.serialize(ClientToken),
            Description=self.serialize(Description),
            Encrypted=self.serialize(Encrypted),
            KmsKeyId=self.serialize(KmsKeyId),
            DestinationOutpostArn=self.serialize(DestinationOutpostArn),
            CopyImageTags=self.serialize(CopyImageTags),
            TagSpecifications=self.serialize(TagSpecifications),
            SnapshotCopyCompletionDurationMinutes=self.serialize(
                SnapshotCopyCompletionDurationMinutes
            ),
            DestinationAvailabilityZone=self.serialize(DestinationAvailabilityZone),
            DestinationAvailabilityZoneId=self.serialize(DestinationAvailabilityZoneId),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.copy_image(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CopyImageResult(**_response)

        results: str = None
        if response is not None:
            results = response.ImageId

        self.sessionize(results)
        return cast("str", results)

    def enable_deregistration_protection(
        self, ImageId: str, *, WithCooldown: bool = False, DryRun: bool = False
    ) -> str:
        """
        Enables deregistration protection for an AMI. When deregistration protection is
        enabled, the AMI can't be deregistered.

        Args:
            ImageId: The ID of the AMI.

        Keyword Args:
            WithCooldown: If ``true``, enforces deregistration protection for 24 hours after deregistration protection is
                disabled.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            ImageId=self.serialize(ImageId),
            WithCooldown=self.serialize(WithCooldown),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.enable_image_deregistration_protection(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = EnableImageDeregistrationProtectionResult(**_response)

        results: str = None
        if response is not None:
            results = response.Return

        self.sessionize(results)
        return cast("str", results)

    def disable_deregistration_protection(
        self, ImageId: str, *, DryRun: bool = False
    ) -> str:
        """
        Disables deregistration protection for an AMI. When deregistration protection is
        disabled, the AMI can be deregistered.

        Args:
            ImageId: The ID of the AMI.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            ImageId=self.serialize(ImageId), DryRun=self.serialize(DryRun)
        )
        _response = self.client.disable_image_deregistration_protection(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DisableImageDeregistrationProtectionResult(**_response)

        results: str = None
        if response is not None:
            results = response.Return

        self.sessionize(results)
        return cast("str", results)


class InstanceManager(EC2TagsManagerMixin, Boto3ModelManager):
    service_name: str = "ec2"

    def create(
        self,
        model: "Instance",
        MaxCount: int,
        MinCount: int,
        DisableApiTermination: bool = False,
        DisableApiStop: bool = False,
        InstanceInitiatedShutdownBehavior: Literal["stop", "terminate"] = "terminate",
        Ipv6AddressCount: int | None = None,
        Ipv6Addresses: List["InstanceIpv6Address"] | None = None,
        SecurityGroupIds: List[str] | None = None,
        UserData: str | None = None,
        ElasticGpuSpecification: List["ElasticGpuSpecification"] | None = None,
        ElasticInferenceAccelerators: List["ElasticInferenceAccelerator"] | None = None,
        LaunchTemplate: Optional["EC2LaunchTemplateSpecification"] = None,
        InstanceMarketOptions: Optional["InstanceMarketOptionsRequest"] = None,
        CreditSpecification: Optional["CreditSpecificationRequest"] = None,
        LicenseSpecifications: List["LicenseConfigurationRequest"] | None = None,
        EnablePrimaryIpv6: bool | None = None,
    ) -> "Instance":
        """
        Launches the specified number of instances using an AMI for which you have
        permissions.

        Args:
            model: The :py:class:`Instance` to create.
            MaxCount: The maximum number of instances to launch. If you specify a value that is more capacity than Amazon EC2
                can launch in the target Availability Zone, Amazon EC2 launches the largest possible number of instances above the
                specified minimum count.
            MinCount: The minimum number of instances to launch. If you specify a value that is more capacity than Amazon EC2
                can provide in the target Availability Zone, Amazon EC2 does not launch any instances.

        Keyword Args:
            DisableApiTermination: Indicates whether termination protection is enabled for the instance. The default is
                ``false``, which means that you can terminate the instance using the Amazon EC2 console, command line tools, or API.
                You can enable termination protection when you launch an instance, while the instance is running, or while the
                instance is stopped.
            DisableApiStop: Indicates whether an instance is enabled for stop protection. For more information, see `Enable stop
                protection for your EC2 instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-stop-protection.html>`_.
            InstanceInitiatedShutdownBehavior: Indicates whether an instance stops or terminates when you initiate shutdown from
                the instance (using the operating system command for system shutdown).
            Ipv6AddressCount: The number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses
                the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific
                IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to
                launch.
            Ipv6Addresses: The IPv6 addresses from the range of the subnet to associate with the primary network interface. You
                cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot
                specify this option if you've specified a minimum number of instances to launch.
            SecurityGroupIds: The IDs of the security groups.
            UserData: The user data to make available to the instance. User data must be base64-encoded. Depending on the tool
                or SDK that you're using, the base64-encoding might be performed for you. For more information, see `Run commands at
                launch using instance user data <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html>`_.
            ElasticGpuSpecification: An elastic GPU to associate with the instance.
            ElasticInferenceAccelerators: An elastic inference accelerator to associate with the instance.
            LaunchTemplate: The launch template. Any additional parameters that you specify for the new instance overwrite the
                corresponding parameters included in the launch template.
            InstanceMarketOptions: The market (purchasing) option for the instances.
            CreditSpecification: The credit option for CPU usage of the burstable performance instance. Valid values are
                ``standard`` and ``unlimited``. To change this attribute after launch, use  `ModifyInstanceCreditSpecification
                <https://docs.aws.amazon.com/AWSEC2/lates t/APIReference/API_ModifyInstanceCreditSpecification.html>`_. 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*.
            LicenseSpecifications: The license configurations.
            EnablePrimaryIpv6: If you’re launching an instance into a dual-stack or IPv6-only subnet, you can enable assigning a
                primary IPv6 address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to
                use a primary IPv6 address. Use this option if an instance relies on its IPv6 address not changing. When you launch
                the instance, Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your
                instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot
                disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary
                IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6
                addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA
                address associated with the ENI becomes the primary IPv6 address.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            MaxCount=self.serialize(MaxCount),
            MinCount=self.serialize(MinCount),
            BlockDeviceMappings=data.get("BlockDeviceMappings"),
            ImageId=data.get("ImageId"),
            InstanceType=data.get("InstanceType"),
            Ipv6AddressCount=self.serialize(Ipv6AddressCount),
            Ipv6Addresses=self.serialize(Ipv6Addresses),
            KernelId=data.get("KernelId"),
            KeyName=data.get("KeyName"),
            Monitoring=data.get("Monitoring"),
            Placement=data.get("Placement"),
            RamdiskId=data.get("RamdiskId"),
            SecurityGroupIds=self.serialize(SecurityGroupIds),
            SubnetId=data.get("SubnetId"),
            UserData=self.serialize(UserData),
            ElasticGpuSpecification=self.serialize(ElasticGpuSpecification),
            ElasticInferenceAccelerators=self.serialize(ElasticInferenceAccelerators),
            TagSpecifications=self.serialize(
                self.serialize(self.convert_tags(model.Tags, "instance"))
            ),
            LaunchTemplate=self.serialize(LaunchTemplate),
            InstanceMarketOptions=self.serialize(InstanceMarketOptions),
            CreditSpecification=self.serialize(CreditSpecification),
            CpuOptions=data.get("CpuOptions"),
            CapacityReservationSpecification=data.get(
                "CapacityReservationSpecification"
            ),
            HibernationOptions=data.get("HibernationOptions"),
            LicenseSpecifications=self.serialize(LicenseSpecifications),
            MetadataOptions=data.get("MetadataOptions"),
            EnclaveOptions=data.get("EnclaveOptions"),
            PrivateDnsNameOptions=data.get("PrivateDnsNameOptions"),
            MaintenanceOptions=data.get("MaintenanceOptions"),
            DisableApiStop=self.serialize(DisableApiStop),
            EnablePrimaryIpv6=self.serialize(EnablePrimaryIpv6),
            NetworkPerformanceOptions=data.get("NetworkPerformanceOptions"),
            Operator=data.get("Operator"),
            DryRun=data.get("DryRun"),
            DisableApiTermination=self.serialize(DisableApiTermination),
            InstanceInitiatedShutdownBehavior=self.serialize(
                InstanceInitiatedShutdownBehavior
            ),
            PrivateIpAddress=data.get("PrivateIpAddress"),
            ClientToken=data.get("ClientToken"),
            NetworkInterfaces=data.get("NetworkInterfaces"),
            IamInstanceProfile=data.get("IamInstanceProfile"),
            EbsOptimized=data.get("EbsOptimized"),
        )
        _response = self.client.run_instances(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = Reservation(**_response)

        self.sessionize(response.Instances[0])
        return cast("Instance", response.Instances[0])

    @ec2_instance_only
    def get(self, InstanceId: str, *, DryRun: bool = False) -> Optional["Reservation"]:
        """
        Describes the specified instances or all instances.

        Args:
            InstanceId: The IDs of the instance.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            InstanceIds=self.serialize([InstanceId]), DryRun=self.serialize(DryRun)
        )
        _response = self.client.describe_instances(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeInstancesResult(**_response)

        if response and response.Reservations:
            self.sessionize(response.Reservations[0])
            return response.Reservations[0]
        return None

    @ec2_instances_only
    def list(
        self,
        *,
        InstanceIds: List[str] | None = None,
        DryRun: bool = False,
        Filters: List[Filter] | None = None,
    ) -> List["Reservation"]:
        """
        Describes the specified instances or all instances.

        Keyword Args:
            InstanceIds: The instance IDs.
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            Filters: The filters.
        """
        paginator = self.client.get_paginator("describe_instances")
        args: Dict[str, Any] = dict(
            InstanceIds=self.serialize(InstanceIds),
            DryRun=self.serialize(DryRun),
            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 = DescribeInstancesResult(**_response)
            if response.Reservations:
                results.extend(response.Reservations)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results

    def start(
        self,
        InstanceIds: List[str],
        *,
        AdditionalInfo: str | None = None,
        DryRun: bool = False,
    ) -> List["InstanceStateChange"] | None:
        """
        Starts an Amazon EBS-backed instance that you've previously stopped.

        Args:
            InstanceIds: The IDs of the instances.

        Keyword Args:
            AdditionalInfo: Reserved.
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            InstanceIds=self.serialize(InstanceIds),
            AdditionalInfo=self.serialize(AdditionalInfo),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.start_instances(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = StartInstancesResult(**_response)

        results: List["InstanceStateChange"] | None = None
        if response is not None:
            results = response.StartingInstances

        self.sessionize(results)
        return cast("List[InstanceStateChange] | None", results)

    def stop(
        self,
        InstanceIds: List[str],
        *,
        Hibernate: bool | None = None,
        SkipOsShutdown: bool | None = None,
        DryRun: bool = False,
        Force: bool | None = None,
    ) -> List["InstanceStateChange"] | None:
        """
        Stops an Amazon EBS-backed instance. You can restart your instance at any time using the
        `StartInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_StartInstances.html>`_ API. For more
        information, see `Stop and start Amazon EC2
        instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html>`_ in the *Amazon EC2 User Guide*.

        Args:
            InstanceIds: The IDs of the instances.

        Keyword Args:
            Hibernate: Hibernates the instance if the instance was enabled for hibernation at launch. If the instance cannot
                hibernate successfully, a normal shutdown occurs. For more information, see `Hibernate your Amazon EC2 instance
                <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html>`_ in the *Amazon EC2 User Guide*.
            SkipOsShutdown: Specifies whether to bypass the graceful OS shutdown process when the instance is stopped.
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            Force: Forces the instance to stop. The instance will first attempt a graceful shutdown, which includes flushing
                file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance
                shuts down forcibly without flushing the file system caches and metadata.

        """
        args: Dict[str, Any] = dict(
            InstanceIds=self.serialize(InstanceIds),
            Hibernate=self.serialize(Hibernate),
            SkipOsShutdown=self.serialize(SkipOsShutdown),
            DryRun=self.serialize(DryRun),
            Force=self.serialize(Force),
        )
        _response = self.client.stop_instances(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = StopInstancesResult(**_response)

        results: List["InstanceStateChange"] | None = None
        if response is not None:
            results = response.StoppingInstances

        self.sessionize(results)
        return cast("List[InstanceStateChange] | None", results)

    def reboot(self, InstanceIds: List[str], *, DryRun: bool = False) -> "None":
        """
        Requests a reboot of the specified instances. This operation is asynchronous; it
        only queues a request to reboot the specified instances. The operation succeeds
        if the instances are valid and belong to you. Requests to reboot terminated
        instances are ignored.

        Args:
            InstanceIds: The instance IDs.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            InstanceIds=self.serialize(InstanceIds), DryRun=self.serialize(DryRun)
        )
        self.client.reboot_instances(**{k: v for k, v in args.items() if v is not None})

    def terminate(
        self,
        InstanceIds: List[str],
        *,
        Force: bool | None = None,
        SkipOsShutdown: bool | None = None,
        DryRun: bool = False,
    ) -> List["InstanceStateChange"] | None:
        """
        Shuts down the specified instances. This operation is
        `idempotent <https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html>`_; if you terminate an instance
        more than once, each call succeeds.

        Args:
            InstanceIds: The IDs of the instances.

        Keyword Args:
            Force: Forces the instances to terminate. The instance will first attempt a graceful shutdown, which includes
                flushing file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the
                instance shuts down forcibly without flushing the file system caches and metadata.
            SkipOsShutdown: Specifies whether to bypass the graceful OS shutdown process when the instance is terminated.
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.

        """
        args: Dict[str, Any] = dict(
            InstanceIds=self.serialize(InstanceIds),
            Force=self.serialize(Force),
            SkipOsShutdown=self.serialize(SkipOsShutdown),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.terminate_instances(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = TerminateInstancesResult(**_response)

        results: List["InstanceStateChange"] | None = None
        if response is not None:
            results = response.TerminatingInstances

        self.sessionize(results)
        return cast("List[InstanceStateChange] | None", results)


class LaunchTemplateManager(EC2TagsManagerMixin, Boto3ModelManager):
    service_name: str = "ec2"

    def create(
        self,
        model: "LaunchTemplate",
        LaunchTemplateData: "RequestLaunchTemplateData",
        ClientToken: str | None = None,
        VersionDescription: str | None = None,
    ) -> "LaunchTemplate":
        """
        Creates a launch template.

        Args:
            model: The :py:class:`LaunchTemplate` to create.
            LaunchTemplateData: The information for the launch template.

        Keyword Args:
            ClientToken: Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If a client
                token isn't specified, a randomly generated token is used in the request to ensure idempotency.
            VersionDescription: A description for the first version of the launch template.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            LaunchTemplateName=data.get("LaunchTemplateName"),
            LaunchTemplateData=self.serialize(LaunchTemplateData),
            DryRun=data.get("DryRun"),
            ClientToken=self.serialize(ClientToken),
            VersionDescription=self.serialize(VersionDescription),
            Operator=data.get("Operator"),
            TagSpecifications=self.serialize(
                self.serialize(self.convert_tags(model.Tags, "launch-template"))
            ),
        )
        _response = self.client.create_launch_template(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateLaunchTemplateResult(**_response)

        self.sessionize(response.LaunchTemplateInstance)
        return cast("LaunchTemplate", response.LaunchTemplateInstance)

    def delete(
        self,
        LaunchTemplateId: str,
        *,
        DryRun: bool = False,
        LaunchTemplateName: str | None = None,
    ) -> "LaunchTemplate":
        """
        Deletes a launch template. Deleting a launch template deletes all of its
        versions.

        Args:
            LaunchTemplateId: The ID of the launch template.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            LaunchTemplateName: The name of the launch template.
        """
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            LaunchTemplateId=self.serialize(LaunchTemplateId),
            LaunchTemplateName=self.serialize(LaunchTemplateName),
        )
        _response = self.client.delete_launch_template(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DeleteLaunchTemplateResult(**_response)
        return cast("LaunchTemplate", response.LaunchTemplateInstance)

    def get(
        self, LaunchTemplateId: str, *, DryRun: bool = False
    ) -> Optional["LaunchTemplate"]:
        """
        Describes one or more launch templates.

        Args:
            LaunchTemplateId: The ID of the launch template.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            LaunchTemplateIds=self.serialize([LaunchTemplateId]),
        )
        _response = self.client.describe_launch_templates(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeLaunchTemplatesResult(**_response)

        if response and response.LaunchTemplates:
            self.sessionize(response.LaunchTemplates[0])
            return response.LaunchTemplates[0]
        return None

    def list(
        self,
        *,
        DryRun: bool = False,
        LaunchTemplateIds: List[str] | None = None,
        LaunchTemplateNames: List[str] | None = None,
        Filters: List[Filter] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes one or more launch templates.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            LaunchTemplateIds: One or more launch template IDs.
            LaunchTemplateNames: One or more launch template names.
            Filters: One or more filters.
        """
        paginator = self.client.get_paginator("describe_launch_templates")
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            LaunchTemplateIds=self.serialize(LaunchTemplateIds),
            LaunchTemplateNames=self.serialize(LaunchTemplateNames),
            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 = DescribeLaunchTemplatesResult(**_response)
            if response.LaunchTemplates:
                results.extend(response.LaunchTemplates)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results


class LaunchTemplateVersionManager(Boto3ModelManager):
    service_name: str = "ec2"

    def create(
        self,
        model: "LaunchTemplateVersion",
        ClientToken: str | None = None,
        SourceVersion: str | None = None,
        ResolveAlias: bool | None = None,
    ) -> "LaunchTemplateVersion":
        """
        Creates a new version of a launch template. You must specify an existing launch
        template, either by name or ID. You can determine whether the new version
        inherits parameters from a source version, and add or overwrite parameters as
        needed.

        Args:
            model: The :py:class:`LaunchTemplateVersion` to create.

        Keyword Args:
            ClientToken: Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If a client
                token isn't specified, a randomly generated token is used in the request to ensure idempotency.
            SourceVersion: The version of the launch template on which to base the new version. Snapshots applied to the block
                device mapping are ignored when creating a new version unless they are explicitly included.
            ResolveAlias: If ``true``, and if a Systems Manager parameter is specified for ``ImageId``, the AMI ID is displayed
                in the response for ``imageID``. For more information, see `Use a Systems Manager parameter instead of an AMI ID
                <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-launch-template.html#use-an-ssm-parameter-instead-of-an-
                ami-id>`_ in the *Amazon EC2 User Guide*.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            LaunchTemplateData=data.get("LaunchTemplateData"),
            DryRun=data.get("DryRun"),
            ClientToken=self.serialize(ClientToken),
            LaunchTemplateId=data.get("LaunchTemplateId"),
            LaunchTemplateName=data.get("LaunchTemplateName"),
            SourceVersion=self.serialize(SourceVersion),
            VersionDescription=data.get("VersionDescription"),
            ResolveAlias=self.serialize(ResolveAlias),
        )
        _response = self.client.create_launch_template_version(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateLaunchTemplateVersionResult(**_response)

        self.sessionize(response.LaunchTemplateVersionInstance)
        return cast("LaunchTemplateVersion", response.LaunchTemplateVersionInstance)

    def delete(
        self, LaunchTemplateId: str, Version: str, *, DryRun: bool = False
    ) -> None:
        """
        Deletes one or more versions of a launch template.

        Args:
            LaunchTemplateId: The ID of the launch template.
            Version: The version number of the launch template version to delete.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            Versions=self.serialize([Version]),
            DryRun=self.serialize(DryRun),
            LaunchTemplateId=self.serialize(LaunchTemplateId),
        )
        self.client.delete_launch_template_versions(
            **{k: v for k, v in args.items() if v is not None}
        )

    def get(
        self,
        LaunchTemplateId: str,
        Version: str,
        *,
        DryRun: bool = False,
        MinVersion: str | None = None,
        MaxVersion: str | None = None,
        Filters: List[Filter] | None = None,
        ResolveAlias: bool | None = None,
    ) -> Optional["LaunchTemplateVersion"]:
        """
        Describes one or more versions of a specified launch template. You can describe
        all versions, individual versions, or a range of versions. You can also describe
        all the latest versions or all the default versions of all the launch templates
        in your account.

        Args:
            LaunchTemplateId: The ID of the launch template.
            Version: The version number of the launch template version.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            MinVersion: The version number after which to describe launch template versions.
            MaxVersion: The version number up to which to describe launch template versions.
            Filters: One or more filters.
            ResolveAlias: If ``true``, and if a Systems Manager parameter is specified for ``ImageId``, the AMI ID is displayed
                in the response for ``imageId``.
        """
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            LaunchTemplateId=self.serialize(LaunchTemplateId),
            Versions=self.serialize([Version]),
            MinVersion=self.serialize(MinVersion),
            MaxVersion=self.serialize(MaxVersion),
            Filters=self.serialize(Filters),
            ResolveAlias=self.serialize(ResolveAlias),
        )
        _response = self.client.describe_launch_template_versions(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeLaunchTemplateVersionsResult(**_response)

        if response and response.LaunchTemplateVersions:
            self.sessionize(response.LaunchTemplateVersions[0])
            return response.LaunchTemplateVersions[0]
        return None

    def list(
        self,
        *,
        DryRun: bool = False,
        LaunchTemplateId: str | None = None,
        LaunchTemplateName: str | None = None,
        Versions: List[str] | None = None,
        MinVersion: str | None = None,
        MaxVersion: str | None = None,
        Filters: List[Filter] | None = None,
        ResolveAlias: bool | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes one or more versions of a specified launch template. You can describe
        all versions, individual versions, or a range of versions. You can also describe
        all the latest versions or all the default versions of all the launch templates
        in your account.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            LaunchTemplateId: The ID of the launch template.
            LaunchTemplateName: The name of the launch template.
            Versions: One or more versions of the launch template. Valid values depend on whether you are describing a specified
                launch template (by ID or name) or all launch templates in your account.
            MinVersion: The version number after which to describe launch template versions.
            MaxVersion: The version number up to which to describe launch template versions.
            Filters: One or more filters.
            ResolveAlias: If ``true``, and if a Systems Manager parameter is specified for ``ImageId``, the AMI ID is displayed
                in the response for ``imageId``.
        """
        paginator = self.client.get_paginator("describe_launch_template_versions")
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            LaunchTemplateId=self.serialize(LaunchTemplateId),
            LaunchTemplateName=self.serialize(LaunchTemplateName),
            Versions=self.serialize(Versions),
            MinVersion=self.serialize(MinVersion),
            MaxVersion=self.serialize(MaxVersion),
            Filters=self.serialize(Filters),
            ResolveAlias=self.serialize(ResolveAlias),
        )
        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 = DescribeLaunchTemplateVersionsResult(**_response)
            if response.LaunchTemplateVersions:
                results.extend(response.LaunchTemplateVersions)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results


class NetworkInterfaceManager(EC2TagsManagerMixin, Boto3ModelManager):
    service_name: str = "ec2"

    def create(
        self,
        model: "NetworkInterface",
        Ipv4PrefixCount: int | None = None,
        Ipv6PrefixCount: int | None = None,
        ClientToken: str | None = None,
        EnablePrimaryIpv6: bool | None = None,
        ConnectionTrackingSpecification: Optional[
            "ConnectionTrackingSpecificationRequest"
        ] = None,
        SecondaryPrivateIpAddressCount: int | None = None,
        Ipv6AddressCount: int | None = None,
    ) -> "NetworkInterface":
        """
        Creates a network interface in the specified subnet.

        Args:
            model: The :py:class:`NetworkInterface` to create.

        Keyword Args:
            Ipv4PrefixCount: The number of IPv4 prefixes that Amazon Web Services automatically assigns to the network
                interface.
            Ipv6PrefixCount: The number of IPv6 prefixes that Amazon Web Services automatically assigns to the network
                interface.
            ClientToken: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more
                information, see `Ensuring idempotency <https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html>`_.
            EnablePrimaryIpv6: If you’re creating a network interface in a dual-stack or IPv6-only subnet, you have the option
                to assign a primary IPv6 IP address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you
                have enabled to use a primary IPv6 address. Use this option if the instance that this ENI will be attached to relies
                on its IPv6 address not changing. Amazon Web Services will automatically assign an IPv6 address associated with the
                ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary
                IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be
                made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have
                multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the
                first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.
            ConnectionTrackingSpecification: A connection tracking specification for the network interface.
            SecondaryPrivateIpAddressCount: The number of secondary private IPv4 addresses to assign to a network interface.
                When you specify a number of secondary IPv4 addresses, Amazon EC2 selects these IP addresses within the subnet's
                IPv4 CIDR range. You can't specify this option and specify more than one private IP address using
                ``privateIpAddresses``.
            Ipv6AddressCount: The number of IPv6 addresses to assign to a network interface. Amazon EC2 automatically selects
                the IPv6 addresses from the subnet range.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            SubnetId=data.get("SubnetId"),
            Ipv4Prefixes=data.get("Ipv4Prefixes"),
            Ipv4PrefixCount=self.serialize(Ipv4PrefixCount),
            Ipv6Prefixes=data.get("Ipv6Prefixes"),
            Ipv6PrefixCount=self.serialize(Ipv6PrefixCount),
            InterfaceType=data.get("InterfaceType"),
            TagSpecifications=self.serialize(
                self.serialize(self.convert_tags(model.Tags, "network-interface"))
            ),
            ClientToken=self.serialize(ClientToken),
            EnablePrimaryIpv6=self.serialize(EnablePrimaryIpv6),
            ConnectionTrackingSpecification=self.serialize(
                ConnectionTrackingSpecification
            ),
            Operator=data.get("Operator"),
            Description=data.get("Description"),
            PrivateIpAddress=data.get("PrivateIpAddress"),
            Groups=data.get("Groups"),
            PrivateIpAddresses=data.get("PrivateIpAddresses"),
            SecondaryPrivateIpAddressCount=self.serialize(
                SecondaryPrivateIpAddressCount
            ),
            Ipv6Addresses=data.get("Ipv6Addresses"),
            Ipv6AddressCount=self.serialize(Ipv6AddressCount),
            DryRun=data.get("DryRun"),
        )
        _response = self.client.create_network_interface(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CreateNetworkInterfaceResult(**_response)

        self.sessionize(response.NetworkInterfaceInstance)
        return cast("NetworkInterface", response.NetworkInterfaceInstance)

    def delete(self, NetworkInterfaceId: str, *, DryRun: bool = False) -> None:
        """
        Deletes the specified network interface. You must detach the network interface
        before you can delete it.

        Args:
            NetworkInterfaceId: The ID of the network interface.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            NetworkInterfaceId=self.serialize(NetworkInterfaceId),
            DryRun=self.serialize(DryRun),
        )
        self.client.delete_network_interface(
            **{k: v for k, v in args.items() if v is not None}
        )

    def get(
        self, NetworkInterfaceId: str, *, DryRun: bool = False
    ) -> Optional["NetworkInterface"]:
        """
        Describes the specified network interfaces or all your network interfaces.

        Args:
            NetworkInterfaceId: The ID of the network interface.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            NetworkInterfaceIds=self.serialize([NetworkInterfaceId]),
        )
        _response = self.client.describe_network_interfaces(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeNetworkInterfacesResult(**_response)

        if response and response.NetworkInterfaces:
            self.sessionize(response.NetworkInterfaces[0])
            return response.NetworkInterfaces[0]
        return None

    def list(
        self,
        *,
        DryRun: bool = False,
        NetworkInterfaceIds: List[str] | None = None,
        Filters: List[Filter] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes the specified network interfaces or all your network interfaces.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            NetworkInterfaceIds: The network interface IDs.
            Filters: One or more filters.
        """
        paginator = self.client.get_paginator("describe_network_interfaces")
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            NetworkInterfaceIds=self.serialize(NetworkInterfaceIds),
            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 = DescribeNetworkInterfacesResult(**_response)
            if response.NetworkInterfaces:
                results.extend(response.NetworkInterfaces)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results

    def attach(
        self,
        NetworkInterfaceId: str,
        InstanceId: str,
        DeviceIndex: int,
        *,
        NetworkCardIndex: int | None = None,
        EnaSrdSpecification: Optional["EnaSrdSpecification"] = None,
        EnaQueueCount: int | None = None,
        DryRun: bool = False,
    ) -> "AttachNetworkInterfaceResult":
        """
        Attaches a network interface to an instance.

        Args:
            NetworkInterfaceId: The ID of the network interface.
            InstanceId: The ID of the instance.
            DeviceIndex: The index of the device for the network interface attachment.

        Keyword Args:
            NetworkCardIndex: The index of the network card. Some instance types support multiple network cards. The primary
                network interface must be assigned to network card index 0. The default is network card index 0.
            EnaSrdSpecification: Configures ENA Express for the network interface that this action attaches to the instance.
            EnaQueueCount: The number of ENA queues to be created with the instance.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            NetworkInterfaceId=self.serialize(NetworkInterfaceId),
            InstanceId=self.serialize(InstanceId),
            DeviceIndex=self.serialize(DeviceIndex),
            NetworkCardIndex=self.serialize(NetworkCardIndex),
            EnaSrdSpecification=self.serialize(EnaSrdSpecification),
            EnaQueueCount=self.serialize(EnaQueueCount),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.attach_network_interface(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = AttachNetworkInterfaceResult(**_response)

        results: "AttachNetworkInterfaceResult" = None
        if response is not None:
            results = response

        self.sessionize(results)
        return cast("AttachNetworkInterfaceResult", results)

    def detach(
        self, AttachmentId: str, *, DryRun: bool = False, Force: bool = False
    ) -> None:
        """
        Detaches a network interface from an instance.

        Args:
            AttachmentId: The ID of the attachment.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            Force: Specifies whether to force a detachment.
        """
        args: Dict[str, Any] = dict(
            AttachmentId=self.serialize(AttachmentId),
            DryRun=self.serialize(DryRun),
            Force=self.serialize(Force),
        )
        self.client.detach_network_interface(
            **{k: v for k, v in args.items() if v is not None}
        )

    def reset(
        self,
        NetworkInterfaceId: str,
        *,
        DryRun: bool = False,
        SourceDestCheck: str | None = None,
    ) -> None:
        """
        Resets a network interface attribute. You can specify only one attribute at a
        time.

        Args:
            NetworkInterfaceId: The ID of the network interface.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            SourceDestCheck: The source/destination checking attribute. Resets the value to ``true``.
        """
        args: Dict[str, Any] = dict(
            NetworkInterfaceId=self.serialize(NetworkInterfaceId),
            DryRun=self.serialize(DryRun),
            SourceDestCheck=self.serialize(SourceDestCheck),
        )
        self.client.reset_network_interface_attribute(
            **{k: v for k, v in args.items() if v is not None}
        )

    def permissions(
        self,
        *,
        NetworkInterfacePermissionIds: List[str] | None = None,
        Filters: List[Filter] | None = None,
    ) -> List["NetworkInterfacePermission"]:
        """
        Describes the permissions for your network interfaces.

        Keyword Args:
            NetworkInterfacePermissionIds: The network interface permission IDs.
            Filters: One or more filters.
        """
        paginator = self.client.get_paginator("describe_network_interface_permissions")
        args: Dict[str, Any] = dict(
            NetworkInterfacePermissionIds=self.serialize(NetworkInterfacePermissionIds),
            Filters=self.serialize(Filters),
        )
        response_iterator = paginator.paginate(
            **{k: v for k, v in args.items() if v is not None}
        )

        results: List["NetworkInterfacePermission"] = []

        for _response in response_iterator:
            response = DescribeNetworkInterfacePermissionsResult(**_response)
            if response.NetworkInterfacePermissions is not None:
                results.extend(response.NetworkInterfacePermissions)
            else:
                break

        self.sessionize(results)
        return cast("List[NetworkInterfacePermission]", results)


class EC2InstanceTypeManager(ReadonlyBoto3ModelManager):
    service_name: str = "ec2"

    def get(
        self,
        InstanceType: str,
        *,
        DryRun: bool = False,
        Filters: List[Filter] | None = None,
    ) -> Optional["EC2InstanceType"]:
        """
        Describes the specified instance types. By default, all instance types for the
        current Region are described. Alternatively, you can filter the results.

        Args:
            InstanceType: The instance type.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            Filters: One or more filters. Filter names and values are case-sensitive.
        """
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            InstanceTypes=self.serialize([InstanceType]),
            Filters=self.serialize(Filters),
        )
        _response = self.client.describe_instance_types(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeInstanceTypesResult(**_response)

        if response and response.InstanceTypes:
            self.sessionize(response.InstanceTypes[0])
            return response.InstanceTypes[0]
        return None

    def list(
        self,
        *,
        DryRun: bool = False,
        InstanceTypes: List[Literal["a1.medium", "a1.large", "a1.xlarge", "a1.2xlarge", "a1.4xlarge", "a1.metal", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge", "c5.large", "c5.xlarge", "c5.2xlarge", "c5.4xlarge", "c5.9xlarge", "c5.12xlarge", "c5.18xlarge", "c5.24xlarge", "c5.metal", "c5a.large", "c5a.xlarge", "c5a.2xlarge", "c5a.4xlarge", "c5a.8xlarge", "c5a.12xlarge", "c5a.16xlarge", "c5a.24xlarge", "c5ad.large", "c5ad.xlarge", "c5ad.2xlarge", "c5ad.4xlarge", "c5ad.8xlarge", "c5ad.12xlarge", "c5ad.16xlarge", "c5ad.24xlarge", "c5d.large", "c5d.xlarge", "c5d.2xlarge", "c5d.4xlarge", "c5d.9xlarge", "c5d.12xlarge", "c5d.18xlarge", "c5d.24xlarge", "c5d.metal", "c5n.large", "c5n.xlarge", "c5n.2xlarge", "c5n.4xlarge", "c5n.9xlarge", "c5n.18xlarge", "c5n.metal", "c6g.medium", "c6g.large", "c6g.xlarge", "c6g.2xlarge", "c6g.4xlarge", "c6g.8xlarge", "c6g.12xlarge", "c6g.16xlarge", "c6g.metal", "c6gd.medium", "c6gd.large", "c6gd.xlarge", "c6gd.2xlarge", "c6gd.4xlarge", "c6gd.8xlarge", "c6gd.12xlarge", "c6gd.16xlarge", "c6gd.metal", "c6gn.medium", "c6gn.large", "c6gn.xlarge", "c6gn.2xlarge", "c6gn.4xlarge", "c6gn.8xlarge", "c6gn.12xlarge", "c6gn.16xlarge", "c6i.large", "c6i.xlarge", "c6i.2xlarge", "c6i.4xlarge", "c6i.8xlarge", "c6i.12xlarge", "c6i.16xlarge", "c6i.24xlarge", "c6i.32xlarge", "c6i.metal", "cc1.4xlarge", "cc2.8xlarge", "cg1.4xlarge", "cr1.8xlarge", "d2.xlarge", "d2.2xlarge", "d2.4xlarge", "d2.8xlarge", "d3.xlarge", "d3.2xlarge", "d3.4xlarge", "d3.8xlarge", "d3en.xlarge", "d3en.2xlarge", "d3en.4xlarge", "d3en.6xlarge", "d3en.8xlarge", "d3en.12xlarge", "dl1.24xlarge", "f1.2xlarge", "f1.4xlarge", "f1.16xlarge", "g2.2xlarge", "g2.8xlarge", "g3.4xlarge", "g3.8xlarge", "g3.16xlarge", "g3s.xlarge", "g4ad.xlarge", "g4ad.2xlarge", "g4ad.4xlarge", "g4ad.8xlarge", "g4ad.16xlarge", "g4dn.xlarge", "g4dn.2xlarge", "g4dn.4xlarge", "g4dn.8xlarge", "g4dn.12xlarge", "g4dn.16xlarge", "g4dn.metal", "g5.xlarge", "g5.2xlarge", "g5.4xlarge", "g5.8xlarge", "g5.12xlarge", "g5.16xlarge", "g5.24xlarge", "g5.48xlarge", "g5g.xlarge", "g5g.2xlarge", "g5g.4xlarge", "g5g.8xlarge", "g5g.16xlarge", "g5g.metal", "hi1.4xlarge", "hpc6a.48xlarge", "hs1.8xlarge", "h1.2xlarge", "h1.4xlarge", "h1.8xlarge", "h1.16xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "i3.large", "i3.xlarge", "i3.2xlarge", "i3.4xlarge", "i3.8xlarge", "i3.16xlarge", "i3.metal", "i3en.large", "i3en.xlarge", "i3en.2xlarge", "i3en.3xlarge", "i3en.6xlarge", "i3en.12xlarge", "i3en.24xlarge", "i3en.metal", "im4gn.large", "im4gn.xlarge", "im4gn.2xlarge", "im4gn.4xlarge", "im4gn.8xlarge", "im4gn.16xlarge", "inf1.xlarge", "inf1.2xlarge", "inf1.6xlarge", "inf1.24xlarge", "is4gen.medium", "is4gen.large", "is4gen.xlarge", "is4gen.2xlarge", "is4gen.4xlarge", "is4gen.8xlarge", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "m4.large", "m4.xlarge", "m4.2xlarge", "m4.4xlarge", "m4.10xlarge", "m4.16xlarge", "m5.large", "m5.xlarge", "m5.2xlarge", "m5.4xlarge", "m5.8xlarge", "m5.12xlarge", "m5.16xlarge", "m5.24xlarge", "m5.metal", "m5a.large", "m5a.xlarge", "m5a.2xlarge", "m5a.4xlarge", "m5a.8xlarge", "m5a.12xlarge", "m5a.16xlarge", "m5a.24xlarge", "m5ad.large", "m5ad.xlarge", "m5ad.2xlarge", "m5ad.4xlarge", "m5ad.8xlarge", "m5ad.12xlarge", "m5ad.16xlarge", "m5ad.24xlarge", "m5d.large", "m5d.xlarge", "m5d.2xlarge", "m5d.4xlarge", "m5d.8xlarge", "m5d.12xlarge", "m5d.16xlarge", "m5d.24xlarge", "m5d.metal", "m5dn.large", "m5dn.xlarge", "m5dn.2xlarge", "m5dn.4xlarge", "m5dn.8xlarge", "m5dn.12xlarge", "m5dn.16xlarge", "m5dn.24xlarge", "m5dn.metal", "m5n.large", "m5n.xlarge", "m5n.2xlarge", "m5n.4xlarge", "m5n.8xlarge", "m5n.12xlarge", "m5n.16xlarge", "m5n.24xlarge", "m5n.metal", "m5zn.large", "m5zn.xlarge", "m5zn.2xlarge", "m5zn.3xlarge", "m5zn.6xlarge", "m5zn.12xlarge", "m5zn.metal", "m6a.large", "m6a.xlarge", "m6a.2xlarge", "m6a.4xlarge", "m6a.8xlarge", "m6a.12xlarge", "m6a.16xlarge", "m6a.24xlarge", "m6a.32xlarge", "m6a.48xlarge", "m6g.metal", "m6g.medium", "m6g.large", "m6g.xlarge", "m6g.2xlarge", "m6g.4xlarge", "m6g.8xlarge", "m6g.12xlarge", "m6g.16xlarge", "m6gd.metal", "m6gd.medium", "m6gd.large", "m6gd.xlarge", "m6gd.2xlarge", "m6gd.4xlarge", "m6gd.8xlarge", "m6gd.12xlarge", "m6gd.16xlarge", "m6i.large", "m6i.xlarge", "m6i.2xlarge", "m6i.4xlarge", "m6i.8xlarge", "m6i.12xlarge", "m6i.16xlarge", "m6i.24xlarge", "m6i.32xlarge", "m6i.metal", "mac1.metal", "p2.xlarge", "p2.8xlarge", "p2.16xlarge", "p3.2xlarge", "p3.8xlarge", "p3.16xlarge", "p3dn.24xlarge", "p4d.24xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "r4.large", "r4.xlarge", "r4.2xlarge", "r4.4xlarge", "r4.8xlarge", "r4.16xlarge", "r5.large", "r5.xlarge", "r5.2xlarge", "r5.4xlarge", "r5.8xlarge", "r5.12xlarge", "r5.16xlarge", "r5.24xlarge", "r5.metal", "r5a.large", "r5a.xlarge", "r5a.2xlarge", "r5a.4xlarge", "r5a.8xlarge", "r5a.12xlarge", "r5a.16xlarge", "r5a.24xlarge", "r5ad.large", "r5ad.xlarge", "r5ad.2xlarge", "r5ad.4xlarge", "r5ad.8xlarge", "r5ad.12xlarge", "r5ad.16xlarge", "r5ad.24xlarge", "r5b.large", "r5b.xlarge", "r5b.2xlarge", "r5b.4xlarge", "r5b.8xlarge", "r5b.12xlarge", "r5b.16xlarge", "r5b.24xlarge", "r5b.metal", "r5d.large", "r5d.xlarge", "r5d.2xlarge", "r5d.4xlarge", "r5d.8xlarge", "r5d.12xlarge", "r5d.16xlarge", "r5d.24xlarge", "r5d.metal", "r5dn.large", "r5dn.xlarge", "r5dn.2xlarge", "r5dn.4xlarge", "r5dn.8xlarge", "r5dn.12xlarge", "r5dn.16xlarge", "r5dn.24xlarge", "r5dn.metal", "r5n.large", "r5n.xlarge", "r5n.2xlarge", "r5n.4xlarge", "r5n.8xlarge", "r5n.12xlarge", "r5n.16xlarge", "r5n.24xlarge", "r5n.metal", "r6g.medium", "r6g.large", "r6g.xlarge", "r6g.2xlarge", "r6g.4xlarge", "r6g.8xlarge", "r6g.12xlarge", "r6g.16xlarge", "r6g.metal", "r6gd.medium", "r6gd.large", "r6gd.xlarge", "r6gd.2xlarge", "r6gd.4xlarge", "r6gd.8xlarge", "r6gd.12xlarge", "r6gd.16xlarge", "r6gd.metal", "r6i.large", "r6i.xlarge", "r6i.2xlarge", "r6i.4xlarge", "r6i.8xlarge", "r6i.12xlarge", "r6i.16xlarge", "r6i.24xlarge", "r6i.32xlarge", "r6i.metal", "t1.micro", "t2.nano", "t2.micro", "t2.small", "t2.medium", "t2.large", "t2.xlarge", "t2.2xlarge", "t3.nano", "t3.micro", "t3.small", "t3.medium", "t3.large", "t3.xlarge", "t3.2xlarge", "t3a.nano", "t3a.micro", "t3a.small", "t3a.medium", "t3a.large", "t3a.xlarge", "t3a.2xlarge", "t4g.nano", "t4g.micro", "t4g.small", "t4g.medium", "t4g.large", "t4g.xlarge", "t4g.2xlarge", "u-6tb1.56xlarge", "u-6tb1.112xlarge", "u-9tb1.112xlarge", "u-12tb1.112xlarge", "u-6tb1.metal", "u-9tb1.metal", "u-12tb1.metal", "u-18tb1.metal", "u-24tb1.metal", "vt1.3xlarge", "vt1.6xlarge", "vt1.24xlarge", "x1.16xlarge", "x1.32xlarge", "x1e.xlarge", "x1e.2xlarge", "x1e.4xlarge", "x1e.8xlarge", "x1e.16xlarge", "x1e.32xlarge", "x2iezn.2xlarge", "x2iezn.4xlarge", "x2iezn.6xlarge", "x2iezn.8xlarge", "x2iezn.12xlarge", "x2iezn.metal", "x2gd.medium", "x2gd.large", "x2gd.xlarge", "x2gd.2xlarge", "x2gd.4xlarge", "x2gd.8xlarge", "x2gd.12xlarge", "x2gd.16xlarge", "x2gd.metal", "z1d.large", "z1d.xlarge", "z1d.2xlarge", "z1d.3xlarge", "z1d.6xlarge", "z1d.12xlarge", "z1d.metal", "x2idn.16xlarge", "x2idn.24xlarge", "x2idn.32xlarge", "x2iedn.xlarge", "x2iedn.2xlarge", "x2iedn.4xlarge", "x2iedn.8xlarge", "x2iedn.16xlarge", "x2iedn.24xlarge", "x2iedn.32xlarge", "c6a.large", "c6a.xlarge", "c6a.2xlarge", "c6a.4xlarge", "c6a.8xlarge", "c6a.12xlarge", "c6a.16xlarge", "c6a.24xlarge", "c6a.32xlarge", "c6a.48xlarge", "c6a.metal", "m6a.metal", "i4i.large", "i4i.xlarge", "i4i.2xlarge", "i4i.4xlarge", "i4i.8xlarge", "i4i.16xlarge", "i4i.32xlarge", "i4i.metal", "x2idn.metal", "x2iedn.metal", "c7g.medium", "c7g.large", "c7g.xlarge", "c7g.2xlarge", "c7g.4xlarge", "c7g.8xlarge", "c7g.12xlarge", "c7g.16xlarge", "mac2.metal", "c6id.large", "c6id.xlarge", "c6id.2xlarge", "c6id.4xlarge", "c6id.8xlarge", "c6id.12xlarge", "c6id.16xlarge", "c6id.24xlarge", "c6id.32xlarge", "c6id.metal", "m6id.large", "m6id.xlarge", "m6id.2xlarge", "m6id.4xlarge", "m6id.8xlarge", "m6id.12xlarge", "m6id.16xlarge", "m6id.24xlarge", "m6id.32xlarge", "m6id.metal", "r6id.large", "r6id.xlarge", "r6id.2xlarge", "r6id.4xlarge", "r6id.8xlarge", "r6id.12xlarge", "r6id.16xlarge", "r6id.24xlarge", "r6id.32xlarge", "r6id.metal", "r6a.large", "r6a.xlarge", "r6a.2xlarge", "r6a.4xlarge", "r6a.8xlarge", "r6a.12xlarge", "r6a.16xlarge", "r6a.24xlarge", "r6a.32xlarge", "r6a.48xlarge", "r6a.metal", "p4de.24xlarge", "u-3tb1.56xlarge", "u-18tb1.112xlarge", "u-24tb1.112xlarge", "trn1.2xlarge", "trn1.32xlarge", "hpc6id.32xlarge", "c6in.large", "c6in.xlarge", "c6in.2xlarge", "c6in.4xlarge", "c6in.8xlarge", "c6in.12xlarge", "c6in.16xlarge", "c6in.24xlarge", "c6in.32xlarge", "m6in.large", "m6in.xlarge", "m6in.2xlarge", "m6in.4xlarge", "m6in.8xlarge", "m6in.12xlarge", "m6in.16xlarge", "m6in.24xlarge", "m6in.32xlarge", "m6idn.large", "m6idn.xlarge", "m6idn.2xlarge", "m6idn.4xlarge", "m6idn.8xlarge", "m6idn.12xlarge", "m6idn.16xlarge", "m6idn.24xlarge", "m6idn.32xlarge", "r6in.large", "r6in.xlarge", "r6in.2xlarge", "r6in.4xlarge", "r6in.8xlarge", "r6in.12xlarge", "r6in.16xlarge", "r6in.24xlarge", "r6in.32xlarge", "r6idn.large", "r6idn.xlarge", "r6idn.2xlarge", "r6idn.4xlarge", "r6idn.8xlarge", "r6idn.12xlarge", "r6idn.16xlarge", "r6idn.24xlarge", "r6idn.32xlarge", "c7g.metal", "m7g.medium", "m7g.large", "m7g.xlarge", "m7g.2xlarge", "m7g.4xlarge", "m7g.8xlarge", "m7g.12xlarge", "m7g.16xlarge", "m7g.metal", "r7g.medium", "r7g.large", "r7g.xlarge", "r7g.2xlarge", "r7g.4xlarge", "r7g.8xlarge", "r7g.12xlarge", "r7g.16xlarge", "r7g.metal", "c6in.metal", "m6in.metal", "m6idn.metal", "r6in.metal", "r6idn.metal", "inf2.xlarge", "inf2.8xlarge", "inf2.24xlarge", "inf2.48xlarge", "trn1n.32xlarge", "i4g.large", "i4g.xlarge", "i4g.2xlarge", "i4g.4xlarge", "i4g.8xlarge", "i4g.16xlarge", "hpc7g.4xlarge", "hpc7g.8xlarge", "hpc7g.16xlarge", "c7gn.medium", "c7gn.large", "c7gn.xlarge", "c7gn.2xlarge", "c7gn.4xlarge", "c7gn.8xlarge", "c7gn.12xlarge", "c7gn.16xlarge", "p5.48xlarge", "m7i.large", "m7i.xlarge", "m7i.2xlarge", "m7i.4xlarge", "m7i.8xlarge", "m7i.12xlarge", "m7i.16xlarge", "m7i.24xlarge", "m7i.48xlarge", "m7i-flex.large", "m7i-flex.xlarge", "m7i-flex.2xlarge", "m7i-flex.4xlarge", "m7i-flex.8xlarge", "m7a.medium", "m7a.large", "m7a.xlarge", "m7a.2xlarge", "m7a.4xlarge", "m7a.8xlarge", "m7a.12xlarge", "m7a.16xlarge", "m7a.24xlarge", "m7a.32xlarge", "m7a.48xlarge", "m7a.metal-48xl", "hpc7a.12xlarge", "hpc7a.24xlarge", "hpc7a.48xlarge", "hpc7a.96xlarge", "c7gd.medium", "c7gd.large", "c7gd.xlarge", "c7gd.2xlarge", "c7gd.4xlarge", "c7gd.8xlarge", "c7gd.12xlarge", "c7gd.16xlarge", "m7gd.medium", "m7gd.large", "m7gd.xlarge", "m7gd.2xlarge", "m7gd.4xlarge", "m7gd.8xlarge", "m7gd.12xlarge", "m7gd.16xlarge", "r7gd.medium", "r7gd.large", "r7gd.xlarge", "r7gd.2xlarge", "r7gd.4xlarge", "r7gd.8xlarge", "r7gd.12xlarge", "r7gd.16xlarge", "r7a.medium", "r7a.large", "r7a.xlarge", "r7a.2xlarge", "r7a.4xlarge", "r7a.8xlarge", "r7a.12xlarge", "r7a.16xlarge", "r7a.24xlarge", "r7a.32xlarge", "r7a.48xlarge", "c7i.large", "c7i.xlarge", "c7i.2xlarge", "c7i.4xlarge", "c7i.8xlarge", "c7i.12xlarge", "c7i.16xlarge", "c7i.24xlarge", "c7i.48xlarge", "mac2-m2pro.metal", "r7iz.large", "r7iz.xlarge", "r7iz.2xlarge", "r7iz.4xlarge", "r7iz.8xlarge", "r7iz.12xlarge", "r7iz.16xlarge", "r7iz.32xlarge", "c7a.medium", "c7a.large", "c7a.xlarge", "c7a.2xlarge", "c7a.4xlarge", "c7a.8xlarge", "c7a.12xlarge", "c7a.16xlarge", "c7a.24xlarge", "c7a.32xlarge", "c7a.48xlarge", "c7a.metal-48xl", "r7a.metal-48xl", "r7i.large", "r7i.xlarge", "r7i.2xlarge", "r7i.4xlarge", "r7i.8xlarge", "r7i.12xlarge", "r7i.16xlarge", "r7i.24xlarge", "r7i.48xlarge", "dl2q.24xlarge", "mac2-m2.metal", "i4i.12xlarge", "i4i.24xlarge", "c7i.metal-24xl", "c7i.metal-48xl", "m7i.metal-24xl", "m7i.metal-48xl", "r7i.metal-24xl", "r7i.metal-48xl", "r7iz.metal-16xl", "r7iz.metal-32xl", "c7gd.metal", "m7gd.metal", "r7gd.metal", "g6.xlarge", "g6.2xlarge", "g6.4xlarge", "g6.8xlarge", "g6.12xlarge", "g6.16xlarge", "g6.24xlarge", "g6.48xlarge", "gr6.4xlarge", "gr6.8xlarge", "c7i-flex.large", "c7i-flex.xlarge", "c7i-flex.2xlarge", "c7i-flex.4xlarge", "c7i-flex.8xlarge", "u7i-12tb.224xlarge", "u7in-16tb.224xlarge", "u7in-24tb.224xlarge", "u7in-32tb.224xlarge", "u7ib-12tb.224xlarge", "c7gn.metal", "r8g.medium", "r8g.large", "r8g.xlarge", "r8g.2xlarge", "r8g.4xlarge", "r8g.8xlarge", "r8g.12xlarge", "r8g.16xlarge", "r8g.24xlarge", "r8g.48xlarge", "r8g.metal-24xl", "r8g.metal-48xl", "mac2-m1ultra.metal", "g6e.xlarge", "g6e.2xlarge", "g6e.4xlarge", "g6e.8xlarge", "g6e.12xlarge", "g6e.16xlarge", "g6e.24xlarge", "g6e.48xlarge", "c8g.medium", "c8g.large", "c8g.xlarge", "c8g.2xlarge", "c8g.4xlarge", "c8g.8xlarge", "c8g.12xlarge", "c8g.16xlarge", "c8g.24xlarge", "c8g.48xlarge", "c8g.metal-24xl", "c8g.metal-48xl", "m8g.medium", "m8g.large", "m8g.xlarge", "m8g.2xlarge", "m8g.4xlarge", "m8g.8xlarge", "m8g.12xlarge", "m8g.16xlarge", "m8g.24xlarge", "m8g.48xlarge", "m8g.metal-24xl", "m8g.metal-48xl", "x8g.medium", "x8g.large", "x8g.xlarge", "x8g.2xlarge", "x8g.4xlarge", "x8g.8xlarge", "x8g.12xlarge", "x8g.16xlarge", "x8g.24xlarge", "x8g.48xlarge", "x8g.metal-24xl", "x8g.metal-48xl", "i7ie.large", "i7ie.xlarge", "i7ie.2xlarge", "i7ie.3xlarge", "i7ie.6xlarge", "i7ie.12xlarge", "i7ie.18xlarge", "i7ie.24xlarge", "i7ie.48xlarge", "i8g.large", "i8g.xlarge", "i8g.2xlarge", "i8g.4xlarge", "i8g.8xlarge", "i8g.12xlarge", "i8g.16xlarge", "i8g.24xlarge", "i8g.metal-24xl", "u7i-6tb.112xlarge", "u7i-8tb.112xlarge", "u7inh-32tb.480xlarge", "p5e.48xlarge", "p5en.48xlarge", "f2.12xlarge", "f2.48xlarge", "trn2.48xlarge", "c7i-flex.12xlarge", "c7i-flex.16xlarge", "m7i-flex.12xlarge", "m7i-flex.16xlarge", "i7ie.metal-24xl", "i7ie.metal-48xl", "i8g.48xlarge", "c8gd.medium", "c8gd.large", "c8gd.xlarge", "c8gd.2xlarge", "c8gd.4xlarge", "c8gd.8xlarge", "c8gd.12xlarge", "c8gd.16xlarge", "c8gd.24xlarge", "c8gd.48xlarge", "c8gd.metal-24xl", "c8gd.metal-48xl", "i7i.large", "i7i.xlarge", "i7i.2xlarge", "i7i.4xlarge", "i7i.8xlarge", "i7i.12xlarge", "i7i.16xlarge", "i7i.24xlarge", "i7i.48xlarge", "i7i.metal-24xl", "i7i.metal-48xl", "p6-b200.48xlarge", "m8gd.medium", "m8gd.large", "m8gd.xlarge", "m8gd.2xlarge", "m8gd.4xlarge", "m8gd.8xlarge", "m8gd.12xlarge", "m8gd.16xlarge", "m8gd.24xlarge", "m8gd.48xlarge", "m8gd.metal-24xl", "m8gd.metal-48xl", "r8gd.medium", "r8gd.large", "r8gd.xlarge", "r8gd.2xlarge", "r8gd.4xlarge", "r8gd.8xlarge", "r8gd.12xlarge", "r8gd.16xlarge", "r8gd.24xlarge", "r8gd.48xlarge", "r8gd.metal-24xl", "r8gd.metal-48xl", "c8gn.medium", "c8gn.large", "c8gn.xlarge", "c8gn.2xlarge", "c8gn.4xlarge", "c8gn.8xlarge", "c8gn.12xlarge", "c8gn.16xlarge", "c8gn.24xlarge", "c8gn.48xlarge", "c8gn.metal-24xl", "c8gn.metal-48xl", "f2.6xlarge", "p6e-gb200.36xlarge", "g6f.large", "g6f.xlarge", "g6f.2xlarge", "g6f.4xlarge", "gr6f.4xlarge", "p5.4xlarge", "r8i.large", "r8i.xlarge", "r8i.2xlarge", "r8i.4xlarge", "r8i.8xlarge", "r8i.12xlarge", "r8i.16xlarge", "r8i.24xlarge", "r8i.32xlarge", "r8i.48xlarge", "r8i.96xlarge", "r8i.metal-48xl", "r8i.metal-96xl", "r8i-flex.large", "r8i-flex.xlarge", "r8i-flex.2xlarge", "r8i-flex.4xlarge", "r8i-flex.8xlarge", "r8i-flex.12xlarge", "r8i-flex.16xlarge", "m8i.large", "m8i.xlarge", "m8i.2xlarge", "m8i.4xlarge", "m8i.8xlarge", "m8i.12xlarge", "m8i.16xlarge", "m8i.24xlarge", "m8i.32xlarge", "m8i.48xlarge", "m8i.96xlarge", "m8i.metal-48xl", "m8i.metal-96xl", "m8i-flex.large", "m8i-flex.xlarge", "m8i-flex.2xlarge", "m8i-flex.4xlarge", "m8i-flex.8xlarge", "m8i-flex.12xlarge", "m8i-flex.16xlarge", "i8ge.large", "i8ge.xlarge", "i8ge.2xlarge", "i8ge.3xlarge", "i8ge.6xlarge", "i8ge.12xlarge", "i8ge.18xlarge", "i8ge.24xlarge", "i8ge.48xlarge", "i8ge.metal-24xl", "i8ge.metal-48xl", "mac-m4.metal", "mac-m4pro.metal", "r8gn.medium", "r8gn.large", "r8gn.xlarge", "r8gn.2xlarge", "r8gn.4xlarge", "r8gn.8xlarge", "r8gn.12xlarge", "r8gn.16xlarge", "r8gn.24xlarge", "r8gn.48xlarge", "r8gn.metal-24xl", "r8gn.metal-48xl"]] | None = None,
        Filters: List[Filter] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes the specified instance types. By default, all instance types for the
        current Region are described. Alternatively, you can filter the results.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            InstanceTypes: The instance types.
            Filters: One or more filters. Filter names and values are case-sensitive.
        """
        paginator = self.client.get_paginator("describe_instance_types")
        args: Dict[str, Any] = dict(
            DryRun=self.serialize(DryRun),
            InstanceTypes=self.serialize(InstanceTypes),
            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 = DescribeInstanceTypesResult(**_response)
            if response.InstanceTypes:
                results.extend(response.InstanceTypes)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results


class SnapshotManager(EC2TagsManagerMixin, Boto3ModelManager):
    service_name: str = "ec2"

    def create(
        self, model: "Snapshot", Location: Literal["regional", "local"] | None = None
    ) -> "Snapshot":
        """
        Creates a snapshot of an EBS volume and stores it in Amazon S3. You can use
        snapshots for backups, to make copies of EBS volumes, and to save data before
        shutting down an instance.

        Args:
            model: The :py:class:`Snapshot` to create.

        Keyword Args:
            Location: Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this
                parameter.
        """
        data = model.model_dump(exclude_none=True, by_alias=True)
        args = dict(
            VolumeId=data.get("VolumeId"),
            Description=data.get("Description"),
            OutpostArn=data.get("OutpostArn"),
            TagSpecifications=self.serialize(
                self.serialize(self.convert_tags(model.Tags, "snapshot"))
            ),
            Location=self.serialize(Location),
            DryRun=data.get("DryRun"),
        )
        _response = self.client.create_snapshot(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = Snapshot(**_response)

        self.sessionize(response)
        return cast("Snapshot", response)

    def get(
        self,
        SnapshotId: str,
        *,
        OwnerIds: List[str] | None = None,
        RestorableByUserIds: List[str] | None = None,
        DryRun: bool = False,
    ) -> Optional["Snapshot"]:
        """
        Describes the specified EBS snapshots available to you or all of the EBS
        snapshots available to you.

        Args:
            SnapshotId: The IDs of the snapshots.

        Keyword Args:
            OwnerIds: Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web
                Services account IDs, ``self``, and ``amazon``.
            RestorableByUserIds: The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            OwnerIds=self.serialize(OwnerIds),
            RestorableByUserIds=self.serialize(RestorableByUserIds),
            SnapshotIds=self.serialize([SnapshotId]),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.describe_snapshots(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeSnapshotsResult(**_response)

        if response and response.Snapshots:
            self.sessionize(response.Snapshots[0])
            return response.Snapshots[0]
        return None

    def list(
        self,
        *,
        OwnerIds: List[str] | None = None,
        RestorableByUserIds: List[str] | None = None,
        SnapshotIds: List[str] | None = None,
        DryRun: bool = False,
        Filters: List[Filter] | None = None,
    ) -> PrimaryBoto3ModelQuerySet:
        """
        Describes the specified EBS snapshots available to you or all of the EBS
        snapshots available to you.

        Keyword Args:
            OwnerIds: Scopes the results to snapshots with the specified owners. You can specify a combination of Amazon Web
                Services account IDs, ``self``, and ``amazon``.
            RestorableByUserIds: The IDs of the Amazon Web Services accounts that can create volumes from the snapshot.
            SnapshotIds: The snapshot IDs.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            Filters: The filters.
        """
        paginator = self.client.get_paginator("describe_snapshots")
        args: Dict[str, Any] = dict(
            OwnerIds=self.serialize(OwnerIds),
            RestorableByUserIds=self.serialize(RestorableByUserIds),
            SnapshotIds=self.serialize(SnapshotIds),
            DryRun=self.serialize(DryRun),
            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 = DescribeSnapshotsResult(**_response)
            if response.Snapshots:
                results.extend(response.Snapshots)
            else:
                if getattr(response, "NextToken", None):
                    continue
                break
        self.sessionize(results)
        if results and isinstance(results[0], Boto3Model):
            return PrimaryBoto3ModelQuerySet(results)
        return results

    def delete(self, SnapshotId: str, *, DryRun: bool = False) -> None:
        """
        Deletes the specified snapshot.

        Args:
            SnapshotId: The ID of the EBS snapshot.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            SnapshotId=self.serialize(SnapshotId), DryRun=self.serialize(DryRun)
        )
        self.client.delete_snapshot(**{k: v for k, v in args.items() if v is not None})

    def enable_block_public_access(
        self,
        State: Literal["block-all-sharing", "block-new-sharing", "unblocked"],
        *,
        DryRun: bool = False,
    ) -> Literal["block-all-sharing", "block-new-sharing", "unblocked"]:
        """
        Enables or modifies the *block public access for snapshots* setting at the
        account level for the specified Amazon Web Services Region. After you enable
        block public access for snapshots in a Region, users can no longer request
        public sharing for snapshots in that Region. Snapshots that are already publicly
        shared are either treated as private or they remain publicly shared, depending
        on the **State** that you specify.

        Args:
            State: The mode in which to enable block public access for snapshots for the Region. Specify one of the following
                values:

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            State=self.serialize(State), DryRun=self.serialize(DryRun)
        )
        _response = self.client.enable_snapshot_block_public_access(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = EnableSnapshotBlockPublicAccessResult(**_response)

        results: Literal["block-all-sharing", "block-new-sharing", "unblocked"] = None
        if response is not None:
            results = response.State

        self.sessionize(results)
        return cast(
            "Literal['block-all-sharing', 'block-new-sharing', 'unblocked']", results
        )

    def disable_block_public_access(
        self, *, DryRun: bool = False
    ) -> Literal["block-all-sharing", "block-new-sharing", "unblocked"]:
        """
        Disables the *block public access for snapshots* setting at the account level
        for the specified Amazon Web Services Region. After you disable block public
        access for snapshots in a Region, users can publicly share snapshots in that
        Region.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(DryRun=self.serialize(DryRun))
        _response = self.client.disable_snapshot_block_public_access(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DisableSnapshotBlockPublicAccessResult(**_response)

        results: Literal["block-all-sharing", "block-new-sharing", "unblocked"] = None
        if response is not None:
            results = response.State

        self.sessionize(results)
        return cast(
            "Literal['block-all-sharing', 'block-new-sharing', 'unblocked']", results
        )

    def get_public_access_block_state(
        self, *, DryRun: bool = False
    ) -> Literal["block-all-sharing", "block-new-sharing", "unblocked"]:
        """
        Gets the current state of *block public access for snapshots* setting for the
        account and Region.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(DryRun=self.serialize(DryRun))
        _response = self.client.get_snapshot_block_public_access_state(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = GetSnapshotBlockPublicAccessStateResult(**_response)

        results: Literal["block-all-sharing", "block-new-sharing", "unblocked"] = None
        if response is not None:
            results = response.State

        self.sessionize(results)
        return cast(
            "Literal['block-all-sharing', 'block-new-sharing', 'unblocked']", results
        )

    def lock(
        self,
        SnapshotId: str,
        LockMode: Literal["compliance", "governance"],
        *,
        DryRun: bool = False,
        CoolOffPeriod: int | None = None,
        LockDuration: int | None = None,
        ExpirationDate: datetime | None = None,
    ) -> "LockSnapshotResult":
        """
        Locks an Amazon EBS snapshot in either *governance* or *compliance* mode to
        protect it against accidental or malicious deletions for a specific duration. A
        locked snapshot can't be deleted.

        Args:
            SnapshotId: The ID of the snapshot to lock.
            LockMode: The mode in which to lock the snapshot. Specify one of the following:

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            CoolOffPeriod: The cooling-off period during which you can unlock the snapshot or modify the lock settings after
                locking the snapshot in compliance mode, in hours. After the cooling-off period expires, you can't unlock or delete
                the snapshot, decrease the lock duration, or change the lock mode. You can increase the lock duration after the
                cooling-off period expires.
            LockDuration: The period of time for which to lock the snapshot, in days. The snapshot lock will automatically
                expire after this period lapses.
            ExpirationDate: The date and time at which the snapshot lock is to automatically expire, in the UTC time zone
                (``YYYY-MM- DDThh:mm:ss.sssZ``).
        """
        args: Dict[str, Any] = dict(
            SnapshotId=self.serialize(SnapshotId),
            LockMode=self.serialize(LockMode),
            DryRun=self.serialize(DryRun),
            CoolOffPeriod=self.serialize(CoolOffPeriod),
            LockDuration=self.serialize(LockDuration),
            ExpirationDate=self.serialize(ExpirationDate),
        )
        _response = self.client.lock_snapshot(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = LockSnapshotResult(**_response)

        results: "LockSnapshotResult" = None
        if response is not None:
            results = response

        self.sessionize(results)
        return cast("LockSnapshotResult", results)

    def list_locked(
        self,
        *,
        Filters: List[Filter] | None = None,
        MaxResults: int | None = None,
        NextToken: str | None = None,
        SnapshotIds: List[str] | None = None,
        DryRun: bool = False,
    ) -> List["LockedSnapshotsInfo"]:
        """
        Describes the lock status for a snapshot.

        Keyword Args:
            Filters: The filters.
            MaxResults: The maximum number of items to return for this request. To get the next page of items, make another
                request with the token returned in the output. For more information, see `Pagination
                <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination>`_.
            NextToken: The token returned from a previous paginated request. Pagination continues from the end of the items
                returned by the previous request.
            SnapshotIds: The IDs of the snapshots for which to view the lock status.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            Filters=self.serialize(Filters),
            MaxResults=self.serialize(MaxResults),
            NextToken=self.serialize(NextToken),
            SnapshotIds=self.serialize(SnapshotIds),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.describe_locked_snapshots(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = DescribeLockedSnapshotsResult(**_response)

        results: List["LockedSnapshotsInfo"] = None
        if response is not None:
            results = response.Snapshots

        self.sessionize(results)
        return cast("List[LockedSnapshotsInfo]", results)

    def unlock(self, SnapshotId: str, *, DryRun: bool = False) -> str:
        """
        Unlocks a snapshot that is locked in governance mode or that is locked in
        compliance mode but still in the cooling-off period. You can't unlock a snapshot
        that is locked in compliance mode after the cooling-off period has expired.

        Args:
            SnapshotId: The ID of the snapshot to unlock.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            SnapshotId=self.serialize(SnapshotId), DryRun=self.serialize(DryRun)
        )
        _response = self.client.unlock_snapshot(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = UnlockSnapshotResult(**_response)

        results: str = None
        if response is not None:
            results = response.SnapshotId

        self.sessionize(results)
        return cast("str", results)

    def copy(
        self,
        SourceRegion: str,
        SourceSnapshotId: str,
        *,
        Description: str | None = None,
        DestinationOutpostArn: str | None = None,
        DestinationRegion: str | None = None,
        Encrypted: bool | None = None,
        KmsKeyId: str | None = None,
        PresignedUrl: str | None = None,
        TagSpecifications: List["TagSpecification"] | None = None,
        CompletionDurationMinutes: int | None = None,
        DestinationAvailabilityZone: str | None = None,
        DryRun: bool = False,
    ) -> str:
        """
        Creates an exact copy of an Amazon EBS snapshot.

        Args:
            SourceRegion: The ID of the Region that contains the snapshot to be copied.
            SourceSnapshotId: The ID of the EBS snapshot to copy.

        Keyword Args:
            Description: A description for the EBS snapshot.
            DestinationOutpostArn: The Amazon Resource Name (ARN) of the Outpost to which to copy the snapshot.
            DestinationRegion: The destination Region to use in the ``PresignedUrl`` parameter of a snapshot copy operation.
                This parameter is only valid for specifying the destination Region in a ``PresignedUrl`` parameter, where it is
                required.
            Encrypted: To encrypt a copy of an unencrypted snapshot if encryption by default is not enabled, enable encryption
                using this parameter. Otherwise, omit this parameter. Copies of encrypted snapshots are encrypted, even if you omit
                this parameter and encryption by default is not enabled. You cannot set this parameter to false. For more
                information, see `Amazon EBS encryption <https://docs.aws.amazon.com/ebs/latest/userguide/ebs-encryption.html>`_ in
                the *Amazon EBS User Guide*.
            KmsKeyId: The identifier of the KMS key to use for Amazon EBS encryption. If this parameter is not specified, your
                KMS key for Amazon EBS is used. If ``KmsKeyId`` is specified, the encrypted state must be ``true``.
            PresignedUrl: When you copy an encrypted source snapshot using the Amazon EC2 Query API, you must supply a pre-
                signed URL. This parameter is optional for unencrypted snapshots. For more information, see `Query requests
                <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html>`_.
            TagSpecifications: The tags to apply to the new snapshot.
            CompletionDurationMinutes: Not supported when copying snapshots to or from Local Zones or Outposts.
            DestinationAvailabilityZone: The Local Zone, for example, ``cn-north-1-pkx-1a`` to which to copy the snapshot.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """
        args: Dict[str, Any] = dict(
            SourceRegion=self.serialize(SourceRegion),
            SourceSnapshotId=self.serialize(SourceSnapshotId),
            Description=self.serialize(Description),
            DestinationOutpostArn=self.serialize(DestinationOutpostArn),
            DestinationRegion=self.serialize(DestinationRegion),
            Encrypted=self.serialize(Encrypted),
            KmsKeyId=self.serialize(KmsKeyId),
            PresignedUrl=self.serialize(PresignedUrl),
            TagSpecifications=self.serialize(TagSpecifications),
            CompletionDurationMinutes=self.serialize(CompletionDurationMinutes),
            DestinationAvailabilityZone=self.serialize(DestinationAvailabilityZone),
            DryRun=self.serialize(DryRun),
        )
        _response = self.client.copy_snapshot(
            **{k: v for k, v in args.items() if v is not None}
        )
        response = CopySnapshotResult(**_response)

        results: str = None
        if response is not None:
            results = response.SnapshotId

        self.sessionize(results)
        return cast("str", results)


# ==============
# Service Models
# ==============


class VpcCidrBlockState(Boto3Model):
    """
    Describes the state of a CIDR block.
    """

    State: Literal["associating", "associated", "disassociating", "disassociated", "failing", "failed"] | None = None
    """
    The state of the CIDR block.
    """
    StatusMessage: str | None = None
    """
    A message about the status of the CIDR block, if applicable.
    """


class VpcIpv6CidrBlockAssociation(Boto3Model):
    """
    Describes an IPv6 CIDR block associated with a VPC.
    """

    AssociationId: str | None = None
    """
    The association ID for the IPv6 CIDR block.
    """
    Ipv6CidrBlock: str | None = None
    """
    The IPv6 CIDR block.
    """
    Ipv6CidrBlockState: VpcCidrBlockState | None = None
    """
    Information about the state of the CIDR block.
    """
    NetworkBorderGroup: str | None = None
    """
    The name of the unique set of Availability Zones, Local Zones, or Wavelength Zones
    from which Amazon Web Services advertises IP addresses, for example, ``us-
    east-1-wl1-bos-wlz-1``.
    """
    Ipv6Pool: str | None = None
    """
    The ID of the IPv6 address pool from which the IPv6 CIDR block is allocated.
    """
    Ipv6AddressAttribute: Literal["public", "private"] | None = None
    """
    Public IPv6 addresses are those advertised on the internet from Amazon Web Services.

    Private IP addresses are not and cannot be advertised on the internet from Amazon
    Web Services.
    """
    IpSource: Literal["amazon", "byoip", "none"] | None = None
    """
    The source that allocated the IP address space.

    ``byoip`` or ``amazon`` indicates public IP address space allocated by
    Amazon or space that you have allocated with Bring your own IP (BYOIP). ``none`` indicates private space.
    """


class VpcCidrBlockAssociation(Boto3Model):
    """
    Describes an IPv4 CIDR block associated with a VPC.
    """

    AssociationId: str | None = None
    """
    The association ID for the IPv4 CIDR block.
    """
    CidrBlock: str | None = None
    """
    The IPv4 CIDR block.
    """
    CidrBlockState: VpcCidrBlockState | None = None
    """
    Information about the state of the CIDR block.
    """


class VpcEncryptionControlExclusion(Boto3Model):
    State: Literal["enabling", "enabled", "disabling", "disabled"] | None = None
    StateMessage: str | None = None


class VpcEncryptionControlExclusions(Boto3Model):
    InternetGateway: VpcEncryptionControlExclusion | None = None
    EgressOnlyInternetGateway: VpcEncryptionControlExclusion | None = None
    NatGateway: VpcEncryptionControlExclusion | None = None
    VirtualPrivateGateway: VpcEncryptionControlExclusion | None = None
    VpcPeering: VpcEncryptionControlExclusion | None = None


class VpcEncryptionControl(TagsDictMixin, Boto3Model):
    tag_class: ClassVar[Type] = Tag
    VpcId: str | None = None
    VpcEncryptionControlId: str | None = None
    Mode: Literal["monitor", "enforce"] | None = None
    State: Literal["enforce-in-progress", "monitor-in-progress", "enforce-failed", "monitor-failed", "deleting", "deleted", "available", "creating", "delete-failed"] | None = None
    StateMessage: str | None = None
    ResourceExclusions: VpcEncryptionControlExclusions | None = None
    Tags: List[Tag] | None = None


class EC2BlockPublicAccessStates(Boto3Model):
    """
    The state of VPC Block Public Access (BPA).
    """

    InternetGatewayBlockMode: Literal["off", "block-bidirectional", "block-ingress"] | None = None
    """
    The mode of VPC BPA.
    """


class Vpc(TagsDictMixin, VpcModelMixin, PrimaryBoto3Model):
    """
    Describes a VPC.
    """

    tag_class: ClassVar[Type] = Tag
    manager_class: ClassVar[Type[Boto3ModelManager]] = VpcManager

    CidrBlock: str
    """
    The primary IPv4 CIDR block for the VPC.
    """
    Tags: List[Tag] | None = None
    """
    Any tags assigned to the VPC.
    """
    OwnerId: str = Field(default=None, frozen=True)
    """
    The ID of the Amazon Web Services account that owns the VPC.
    """
    InstanceTenancy: Literal["default", "dedicated", "host"] | None = None
    """
    The allowed tenancy of instances launched into the VPC.
    """
    Ipv6CidrBlockAssociationSet: List["VpcIpv6CidrBlockAssociation"] = Field(
        default_factory=list, frozen=True
    )
    """
    Information about the IPv6 CIDR blocks associated with the VPC.
    """
    CidrBlockAssociationSet: List["VpcCidrBlockAssociation"] = Field(
        default_factory=list, frozen=True
    )
    """
    Information about the IPv4 CIDR blocks associated with the VPC.
    """
    IsDefault: bool = Field(default=None, frozen=True)
    """
    Indicates whether the VPC is the default VPC.
    """
    EncryptionControl: VpcEncryptionControl = Field(default=None, frozen=True)
    BlockPublicAccessStates: EC2BlockPublicAccessStates = Field(
        default=None, frozen=True
    )
    """
    The state of VPC Block Public Access (BPA).
    """
    VpcId: str = Field(default=None, frozen=True)
    """
    The ID of the VPC.
    """
    State: Literal["pending", "available"] = Field(default=None, frozen=True)
    """
    The current state of the VPC.
    """
    DhcpOptionsId: str = Field(default=None, frozen=True)
    """
    The ID of the set of DHCP options you've associated with the VPC.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the :py:attr:`VpcId`
        attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.VpcId

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the
        :py:attr:`self.tags["Name"] if "Name" in self.tags else None` attribute.

        Returns:
            The name of the model instance.
        """
        return self.self.tags["Name"] if "Name" in self.tags else None

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`VpcId` attribute.
        """
        return hash(self.VpcId)

    @cached_property
    def subnets(self) -> List["Subnet"] | None:
        """
        Return the :py:class:`Subnet` objects that belong to this VPC, 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(
                {
                    "Filters": [{"Name": "vpc-id", "Values": [self.VpcId]}],
                }
            )
        except AttributeError:
            return []
        return Subnet.objects.using(self.session).list(**pk)  # type: ignore[arg-type]

    @cached_property
    def security_groups(self) -> List["SecurityGroup"] | None:
        """
        Return the :py:class:`SecurityGroup` objects that belong to this VPC, 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(
                {
                    "Filters": [{"Name": "vpc-id", "Values": [self.VpcId]}],
                }
            )
        except AttributeError:
            return []
        return SecurityGroup.objects.using(self.session).list(**pk)  # type: ignore[arg-type]

    @cached_property
    def network_acls(self) -> List["NetworkAcl"] | None:
        """
        Return the :py:class:`NetworkAcl` objects that belong to this VPC, 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(
                {
                    "Filters": [{"Name": "vpc-id", "Values": [self.VpcId]}],
                }
            )
        except AttributeError:
            return []
        return NetworkAcl.objects.using(self.session).list(**pk)  # type: ignore[arg-type]


class SubnetCidrBlockState(Boto3Model):
    """
    Describes the state of a CIDR block.
    """

    State: Literal["associating", "associated", "disassociating", "disassociated", "failing", "failed"] | None = None
    """
    The state of a CIDR block.
    """
    StatusMessage: str | None = None
    """
    A message about the status of the CIDR block, if applicable.
    """


class SubnetIpv6CidrBlockAssociation(Boto3Model):
    """
    Describes an association between a subnet and an IPv6 CIDR block.
    """

    AssociationId: str | None = None
    """
    The ID of the association.
    """
    Ipv6CidrBlock: str | None = None
    """
    The IPv6 CIDR block.
    """
    Ipv6CidrBlockState: SubnetCidrBlockState | None = None
    """
    The state of the CIDR block.
    """
    Ipv6AddressAttribute: Literal["public", "private"] | None = None
    """
    Public IPv6 addresses are those advertised on the internet from Amazon Web Services.

    Private IP addresses are not and cannot be advertised on the internet from Amazon
    Web Services.
    """
    IpSource: Literal["amazon", "byoip", "none"] | None = None
    """
    The source that allocated the IP address space.

    ``byoip`` or ``amazon`` indicates public IP address space allocated by
    Amazon or space that you have allocated with Bring your own IP (BYOIP). ``none`` indicates private space.
    """


class EC2PrivateDnsNameOptionsOnLaunch(Boto3Model):
    """
    Describes the options for instance hostnames.
    """

    HostnameType: Literal["ip-name", "resource-name"] | None = None
    """
    The type of hostname for EC2 instances.

    For IPv4 only subnets, an instance DNS name must be based on the instance IPv4
    address. For IPv6 only subnets, an instance DNS name must be based on the instance
    ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4
    address or the instance ID.
    """
    EnableResourceNameDnsARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS A
    records.
    """
    EnableResourceNameDnsAAAARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostname with DNS AAAA
    records.
    """


class Subnet(TagsDictMixin, SubnetModelMixin, PrimaryBoto3Model):
    """
    Describes a subnet.
    """

    tag_class: ClassVar[Type] = Tag
    manager_class: ClassVar[Type[Boto3ModelManager]] = SubnetManager

    VpcId: str
    """
    The ID of the VPC the subnet is in.
    """
    AvailabilityZone: str
    """
    The Availability Zone of the subnet.
    """
    CidrBlock: str
    """
    The IPv4 CIDR block assigned to the subnet.
    """
    Ipv6Native: bool | None = False
    """
    Indicates whether this is an IPv6 only subnet.
    """
    Tags: List[Tag] | None = None
    """
    Any tags assigned to the subnet.
    """
    AvailabilityZoneId: str | None = None
    """
    The AZ ID of the subnet.
    """
    EnableLniAtDeviceIndex: int = Field(default=None, frozen=True)
    """
    Indicates the device position for local network interfaces in this subnet.

    For example, ``1`` indicates local network
    interfaces in this subnet are the secondary network interface (eth1).
    """
    MapCustomerOwnedIpOnLaunch: bool = Field(default=None, frozen=True)
    """
    Indicates whether a network interface created in this subnet (including a network
    interface created by RunInstances) receives a customer-owned IPv4 address.
    """
    CustomerOwnedIpv4Pool: str = Field(default=None, frozen=True)
    """
    The customer-owned IPv4 address pool associated with the subnet.
    """
    OwnerId: str = Field(default=None, frozen=True)
    """
    The ID of the Amazon Web Services account that owns the subnet.
    """
    AssignIpv6AddressOnCreation: bool = Field(default=None, frozen=True)
    """
    Indicates whether a network interface created in this subnet (including a network
    interface created by RunInstances) receives an IPv6 address.
    """
    Ipv6CidrBlockAssociationSet: List["SubnetIpv6CidrBlockAssociation"] = Field(
        default_factory=list, frozen=True
    )
    """
    Information about the IPv6 CIDR blocks associated with the subnet.
    """
    SubnetArn: str = Field(default=None, frozen=True)
    """
    The Amazon Resource Name (ARN) of the subnet.
    """
    OutpostArn: str | None = None
    """
    The Amazon Resource Name (ARN) of the Outpost.
    """
    EnableDns64: bool = Field(default=None, frozen=True)
    """
    Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this
    subnet should return synthetic IPv6 addresses for IPv4-only destinations.
    """
    PrivateDnsNameOptionsOnLaunch: EC2PrivateDnsNameOptionsOnLaunch = Field(
        default=None, frozen=True
    )
    """
    The type of hostnames to assign to instances in the subnet at launch.

    An instance hostname is based on the IPv4 address or ID of the instance.
    """
    BlockPublicAccessStates: EC2BlockPublicAccessStates = Field(
        default=None, frozen=True
    )
    """
    The state of VPC Block Public Access (BPA).
    """
    Type: str = Field(default=None, frozen=True)
    """
    Indicates if this is a subnet used with Amazon Elastic VMware Service (EVS).

    Possible values are ``Elastic VMware
    Service`` or no value. For more information about Amazon EVS, see  `*Amazon Elastic VMware Service API
    Reference* <https://docs.aws.amazon.com/evs/latest/APIReference/Welcome.html>`_ .
    """
    SubnetId: str = Field(default=None, frozen=True)
    """
    The ID of the subnet.
    """
    State: Literal[
        "pending", "available", "unavailable", "failed", "failed-insufficient-capacity"
    ] = Field(default=None, frozen=True)
    """
    The current state of the subnet.
    """
    AvailableIpAddressCount: int = Field(default=None, frozen=True)
    """
    The number of unused private IPv4 addresses in the subnet.

    The IPv4 addresses for any stopped instances are considered unavailable.
    """
    DefaultForAz: bool = Field(default=None, frozen=True)
    """
    Indicates whether this is the default subnet for the Availability Zone.
    """
    MapPublicIpOnLaunch: bool = Field(default=None, frozen=True)
    """
    Indicates whether instances launched in this subnet receive a public IPv4 address.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`SubnetId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.SubnetId

    @property
    def arn(self) -> str | None:
        """
        Return the ARN of the model.   This is the value of the :py:attr:`SubnetArn`
        attribute.

        Returns:
            The ARN of the model instance.
        """
        return self.SubnetArn

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the
        :py:attr:`self.tags["Name"] if "Name" in self.tags else None` attribute.

        Returns:
            The name of the model instance.
        """
        return self.self.tags["Name"] if "Name" in self.tags else None

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`SubnetId` attribute.
        """
        return hash(self.SubnetId)

    @cached_property
    def vpc(self) -> Optional["Vpc"]:
        """
        Return the :py:class:`Vpc` object that this subnet belongs to, 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(
                {
                    "VpcId": self.VpcId,
                }
            )
        except AttributeError:
            return None
        return Vpc.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def instances(self) -> List["Instance"] | None:
        """
        Return the :py:class:`Instance` objects that belong to this subnet, 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(
                {
                    "Filters": [{"Name": "subnet-id", "Values": [self.SubnetId]}],
                }
            )
        except AttributeError:
            return []
        return Instance.objects.using(self.session).list(**pk)  # type: ignore[arg-type]


class UserIdGroupPair(Boto3Model):
    """
    Describes a security group and Amazon Web Services account ID pair.
    """

    Description: str | None = None
    """
    A description for the security group rule that references this user ID group pair.
    """
    UserId: str | None = None
    """
    The ID of an Amazon Web Services account.
    """
    GroupName: str | None = None
    """
    [Default VPC] The name of the security group.

    For a security group in a nondefault VPC, use the security group ID.
    """
    GroupId: str | None = None
    """
    The ID of the security group.
    """
    VpcId: str | None = None
    """
    The ID of the VPC for the referenced security group, if applicable.
    """
    VpcPeeringConnectionId: str | None = None
    """
    The ID of the VPC peering connection, if applicable.
    """
    PeeringStatus: str | None = None
    """
    The status of a VPC peering connection, if applicable.
    """


class IpRange(Boto3Model):
    """
    Describes an IPv4 address range.
    """

    Description: str | None = None
    """
    A description for the security group rule that references this IPv4 address range.
    """
    CidrIp: str | None = None
    """
    The IPv4 address range.

    You can either specify a CIDR block or a source security group, not both. To specify
    a single IPv4 address, use the /32 prefix length.
    """


class Ipv6Range(Boto3Model):
    """
    Describes an IPv6 address range.
    """

    Description: str | None = None
    """
    A description for the security group rule that references this IPv6 address range.
    """
    CidrIpv6: str | None = None
    """
    The IPv6 address range.

    You can either specify a CIDR block or a source security group, not both. To specify
    a single IPv6 address, use the /128 prefix length.
    """


class PrefixListId(Boto3Model):
    """
    Describes a prefix list ID.
    """

    Description: str | None = None
    """
    A description for the security group rule that references this prefix list ID.
    """
    PrefixListId: str | None = None
    """
    The ID of the prefix.
    """


class IpPermission(Boto3Model):
    """
    Describes the permissions for a security group rule.
    """

    IpProtocol: str | None = None
    """
The IP protocol name (``tcp``, ``udp``, ``icmp``, ``icmpv6``) or number (see `Protocol
Numbers <http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml>`_).
    """
    FromPort: int | None = None
    """
    If the protocol is TCP or UDP, this is the start of the port range.

    If the protocol is ICMP or ICMPv6, this is the ICMP type or -1 (all ICMP types).
    """
    ToPort: int | None = None
    """
    If the protocol is TCP or UDP, this is the end of the port range.

    If the protocol is ICMP or ICMPv6, this is the ICMP code or -1 (all ICMP codes). If
    the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP
    codes).
    """
    UserIdGroupPairs: List["UserIdGroupPair"] | None = None
    """
    The security group and Amazon Web Services account ID pairs.
    """
    IpRanges: List["IpRange"] | None = None
    """
    The IPv4 address ranges.
    """
    Ipv6Ranges: List["Ipv6Range"] | None = None
    """
    The IPv6 address ranges.
    """
    PrefixListIds: List["PrefixListId"] | None = None
    """
    The prefix list IDs.
    """


class SecurityGroup(TagsDictMixin, SecurityGroupModelMixin, PrimaryBoto3Model):
    """
    Describes a security group.
    """

    tag_class: ClassVar[Type] = Tag
    manager_class: ClassVar[Type[Boto3ModelManager]] = SecurityGroupManager

    VpcId: str
    """
    The ID of the VPC for the security group.
    """
    GroupName: str
    """
    The name of the security group.
    """
    Description: str
    """
    A description of the security group.
    """
    IpPermissions: List["IpPermission"] | None = None
    """
    The inbound rules associated with the security group.
    """
    IpPermissionsEgress: List["IpPermission"] | None = None
    """
    The outbound rules associated with the security group.
    """
    Tags: List[Tag] | None = None
    """
    Any tags assigned to the security group.
    """
    GroupId: str = Field(default=None, frozen=True)
    """
    The ID of the security group.
    """
    SecurityGroupArn: str = Field(default=None, frozen=True)
    """
    The ARN of the security group.
    """
    OwnerId: str = Field(default=None, frozen=True)
    """
    The Amazon Web Services account ID of the owner of the security group.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`GroupId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.GroupId

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the :py:attr:`GroupName`
        attribute.

        Returns:
            The name of the model instance.
        """
        return self.GroupName

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`GroupId` attribute.
        """
        return hash(self.GroupId)

    @cached_property
    def vpc(self) -> Optional["Vpc"]:
        """
        Return the :py:class:`Vpc` object that this security group belongs to, 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(
                {
                    "VpcId": self.VpcId,
                }
            )
        except AttributeError:
            return None
        return Vpc.objects.using(self.session).get(**pk)  # type: ignore[arg-type]


class NetworkAclAssociation(Boto3Model):
    """
    Describes an association between a network ACL and a subnet.
    """

    NetworkAclAssociationId: str | None = None
    """
    The ID of the association between a network ACL and a subnet.
    """
    NetworkAclId: str | None = None
    """
    The ID of the network ACL.
    """
    SubnetId: str | None = None
    """
    The ID of the subnet.
    """


class EC2IcmpTypeCode(Boto3Model):
    """
    Describes the ICMP type and code.
    """

    Code: int | None = None
    """
    The ICMP code.

    A value of -1 means all codes for the specified ICMP type.
    """
    Type: int | None = None
    """
    The ICMP type.

    A value of -1 means all types.
    """


class NetworkAclPortRange(Boto3Model):
    """
    Describes a range of ports.
    """

    From: int | None = None
    """
    The first port in the range.
    """
    To: int | None = None
    """
    The last port in the range.
    """


class NetworkAclEntry(Boto3Model):
    """
    Describes an entry in a network ACL.
    """

    CidrBlock: str | None = None
    """
    The IPv4 network range to allow or deny, in CIDR notation.
    """
    Egress: bool | None = None
    """
    Indicates whether the rule is an egress rule (applied to traffic leaving the
    subnet).
    """
    IcmpTypeCode: EC2IcmpTypeCode | None = None
    """
ICMP protocol: The ICMP type and code.
    """
    Ipv6CidrBlock: str | None = None
    """
    The IPv6 network range to allow or deny, in CIDR notation.
    """
    PortRange: NetworkAclPortRange | None = None
    """
TCP or UDP protocols: The range of ports the rule applies to.
    """
    Protocol: str | None = None
    """
    The protocol number.

    A value of "-1" means all protocols.
    """
    RuleAction: Literal["allow", "deny"] | None = None
    """
    Indicates whether to allow or deny the traffic that matches the rule.
    """
    RuleNumber: int | None = None
    """
    The rule number for the entry.

    ACL entries are processed in ascending order by rule number.
    """


class NetworkAcl(TagsDictMixin, PrimaryBoto3Model):
    """
    Describes a network ACL.
    """

    tag_class: ClassVar[Type] = Tag
    manager_class: ClassVar[Type[Boto3ModelManager]] = NetworkAclManager

    Associations: List["NetworkAclAssociation"] = Field(
        default_factory=list, frozen=True
    )
    """
    Any associations between the network ACL and your subnets.
    """
    Entries: List["NetworkAclEntry"] = Field(default_factory=list, frozen=True)
    """
    The entries (rules) in the network ACL.
    """
    IsDefault: bool = Field(default=None, frozen=True)
    """
    Indicates whether this is the default network ACL for the VPC.
    """
    NetworkAclId: str = Field(default=None, frozen=True)
    """
    The ID of the network ACL.
    """
    Tags: List[Tag] = Field(default_factory=list, frozen=True)
    """
    Any tags assigned to the network ACL.
    """
    VpcId: str | None = None
    """
    The ID of the VPC for the network ACL.
    """
    OwnerId: str = Field(default=None, frozen=True)
    """
    The ID of the Amazon Web Services account that owns the network ACL.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`NetworkAclId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.NetworkAclId

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the
        :py:attr:`self.tags["Name"] if "Name" in self.tags else None` attribute.

        Returns:
            The name of the model instance.
        """
        return self.self.tags["Name"] if "Name" in self.tags else None

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`NetworkAclId` attribute.
        """
        return hash(self.NetworkAclId)

    @cached_property
    def vpc(self) -> Optional["Vpc"]:
        """
        Return the :py:class:`Vpc` object that this network ACL belongs to, 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(
                {
                    "VpcId": self.VpcId,
                }
            )
        except AttributeError:
            return None
        return Vpc.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def subnets(self) -> List["Subnet"] | None:
        """
        Return the :py:class:`Subnet` objects that this network ACL belongs to, 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(
                {
                    "Filters": [
                        {"Name": "association.subnet-id", "Values": [self.SubnetId]}
                    ],
                }
            )
        except AttributeError:
            return []
        return Subnet.objects.using(self.session).list(**pk)  # type: ignore[arg-type]


class ProductCode(Boto3Model):
    """
    Describes a product code.
    """

    ProductCodeId: str | None = None
    """
    The product code.
    """
    ProductCodeType: Literal["devpay", "marketplace"] | None = None
    """
    The type of product code.
    """


class EC2StateReason(Boto3Model):
    """
    Describes a state change.
    """

    Code: str | None = None
    """
    The reason code for the state change.
    """
    Message: str | None = None
    """
    The message for the state change.
    """


class EbsBlockDevice(Boto3Model):
    """
    Describes a block device for an EBS volume.
    """

    DeleteOnTermination: bool | None = None
    """
    Indicates whether the EBS volume is deleted on instance termination.

    For more information, see `Preserving Amazon EBS
    volumes on instance termination <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-
    instances.html#preserving-volumes-on-termination>`_ in the *Amazon EC2 User Guide*.
    """
    Iops: int | None = None
    """
    The number of I/O operations per second (IOPS).

    For ``gp3``, ``io1``, and ``io2`` 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.
    """
    SnapshotId: str | None = None
    """
    The ID of the snapshot.
    """
    VolumeSize: int | None = None
    """
    The size of the volume, in GiBs.

    You must specify either a snapshot ID or a volume size. If you specify a snapshot,
    the default is the snapshot size. You can specify a volume size that is equal to or
    larger than the snapshot size.
    """
    VolumeType: Literal["standard", "io1", "io2", "gp2", "sc1", "st1", "gp3"] | 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*.
    """
    KmsKeyId: str | None = None
    """
    Identifier (key ID, key alias, key ARN, or alias ARN) of the customer managed KMS
    key to use for EBS encryption.
    """
    Throughput: int | None = None
    """
    The throughput that the volume supports, in MiB/s.
    """
    OutpostArn: str | None = None
    """
    The ARN of the Outpost on which the snapshot is stored.
    """
    AvailabilityZone: str | None = None
    """
    The Availability Zone where the EBS volume will be created (for example, ``us-
    east-1a``).
    """
    Encrypted: bool | None = None
    """
    Indicates whether the encryption state of an EBS volume is changed while being
    restored from a backing snapshot.

    The
    effect of setting the encryption state to ``true`` depends on the volume origin (new or from a snapshot), starting
    encryption state, ownership, and whether encryption by default is enabled. For more information, see `Amazon EBS
    encryption <https://docs.aws.amazon.com/ebs/latest/userguide/ebs-encryption.html#encryption-parameters>`_ in the *Amazon
    EBS User Guide*.
    """
    VolumeInitializationRate: int | None = None
    """
    Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume
    initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon
    S3 to the volume.

    This is also known as *volume initialization*. Specifying a volume initialization
    rate ensures that the volume is initialized at a predictable and consistent rate
    after creation.
    """
    AvailabilityZoneId: str | None = None
    """
    The ID of the Availability Zone where the EBS volume will be created (for example,
    ``use1-az1``).
    """


class EC2BlockDeviceMapping(Boto3Model):
    """
    Describes a block device mapping, which defines the EBS volumes and instance store
    volumes to attach to an instance at launch.
    """

    Ebs: EbsBlockDevice | None = None
    """
    Parameters used to automatically set up EBS volumes when the instance is launched.
    """
    NoDevice: str | None = None
    """
    To omit the device from the block device mapping, specify an empty string.

    When this property is specified, the device is removed from the block device mapping
    regardless of the assigned value.
    """
    DeviceName: str | None = None
    """
    The device name.

    For available device names, see
    `Device names for volumes <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html>`_.
    """
    VirtualName: str | None = None
    """
    The virtual device name (``ephemeral``N).

    Instance store volumes are numbered starting from 0. An instance type with 2
    available instance store volumes can specify mappings for ``ephemeral0`` and ``ephemeral1``. The number of available
    instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.
    """


class AMI(TagsDictMixin, AMIModelMixin, PrimaryBoto3Model):
    """
    Describes an image.
    """

    tag_class: ClassVar[Type] = Tag
    manager_class: ClassVar[Type[Boto3ModelManager]] = AMIManager

    Architecture: Literal["i386", "x86_64", "arm64", "x86_64_mac", "arm64_mac"] = Field(
        default=None, frozen=True
    )
    """
    The architecture of the image.
    """
    ImageId: str = Field(default=None, frozen=True)
    """
    The ID of the AMI.
    """
    ImageType: Literal["machine", "kernel", "ramdisk"] = Field(
        default=None, frozen=True
    )
    """
    The type of image.
    """
    Public: bool = Field(default=None, frozen=True)
    """
    Indicates whether the image has public launch permissions.

    The value is ``true`` if this image has public launch
    permissions or ``false`` if it has only implicit and explicit launch permissions.
    """
    KernelId: str = Field(default=None, frozen=True)
    """
    The kernel associated with the image, if any.

    Only applicable for machine images.
    """
    Platform: Literal["windows"] | None = Field(default=None, frozen=True)
    """
    This value is set to ``windows`` for Windows AMIs; otherwise, it is blank.
    """
    PlatformDetails: str = Field(default=None, frozen=True)
    """
    The platform details associated with the billing code of the AMI.

    For more information, see
    `Understand AMI billing information <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-billing-info.html>`_
    in the *Amazon EC2 User Guide*.
    """
    UsageOperation: str = Field(default=None, frozen=True)
    """
    The operation of the Amazon EC2 instance and the billing code that is associated
    with the AMI.

    ``usageOperation``
    corresponds to the `lineitem/Operation <https://docs.aws.amazon.com/cur/latest/userguide/Lineitem-columns.html#Lineitem-
    details-O-Operation>`_ column on your Amazon Web Services Cost and Usage Report and in the `Amazon Web Services Price List
    API <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/price-changes.html>`_. You can view these fields on the
    **Instances** or **AMIs** pages in the Amazon EC2 console, or in the responses that are returned by the
    `DescribeImages <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html>`_ command in the Amazon
    EC2 API, or the `describe-images <https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html>`_ command in
    the CLI.
    """
    ProductCodes: List["ProductCode"] = Field(default_factory=list, frozen=True)
    """
    Any product codes associated with the AMI.
    """
    RamdiskId: str = Field(default=None, frozen=True)
    """
    The RAM disk associated with the image, if any.

    Only applicable for machine images.
    """
    State: Literal[
        "pending",
        "available",
        "invalid",
        "deregistered",
        "transient",
        "failed",
        "error",
        "disabled",
    ] = Field(default=None, frozen=True)
    """
    The current state of the AMI.

    If the state is ``available``, the image is successfully registered and can be used to
    launch an instance.
    """
    EnaSupport: bool = Field(default=None, frozen=True)
    """
    Specifies whether enhanced networking with ENA is enabled.
    """
    ImageOwnerAlias: str = Field(default=None, frozen=True)
    """
    The owner alias (``amazon`` | ``aws-backup-vault`` | ``aws-marketplace``).
    """
    RootDeviceName: str = Field(default=None, frozen=True)
    """
    The device name of the root device volume (for example, ``/dev/sda1``).
    """
    RootDeviceType: Literal["ebs", "instance-store"] = Field(default=None, frozen=True)
    """
    The type of root device used by the AMI.

    The AMI can use an Amazon EBS volume or an instance store volume.
    """
    SriovNetSupport: str = Field(default=None, frozen=True)
    """
    Specifies whether enhanced networking with the Intel 82599 Virtual Function
    interface is enabled.
    """
    VirtualizationType: Literal["hvm", "paravirtual"] = Field(default=None, frozen=True)
    """
    The type of virtualization of the AMI.
    """
    StateReason: EC2StateReason = Field(default=None, frozen=True)
    """
    The reason for the state change.
    """
    BootMode: Literal["legacy-bios", "uefi", "uefi-preferred"] = Field(
        default=None, frozen=True
    )
    """
    The boot mode of the image.

    For more information, see
    `Instance launch behavior with Amazon EC2 boot modes <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html>`_
    in the *Amazon EC2 User Guide*.
    """
    DeprecationTime: str = Field(default=None, frozen=True)
    """
    The date and time to deprecate the AMI, in UTC, in the following format:
    *YYYY*-*MM*-*DD*T*HH*:*MM*:*SS*Z.

    If you specified a value for seconds, Amazon EC2 rounds the seconds to the nearest
    minute.
    """
    ImdsSupport: Literal["v2.0"] = Field(default=None, frozen=True)
    """
    If ``v2.0``, it indicates that IMDSv2 is specified in the AMI.

    Instances launched from this AMI will have ``HttpTokens``
    automatically set to ``required`` so that, by default, the instance requires that IMDSv2 is used when requesting
    instance metadata. In addition, ``HttpPutResponseHopLimit`` is set to ``2``. For more information, see `Configure the
    AMI <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html#configure-IMDS-new-
    instances-ami-configuration>`_ in the *Amazon EC2 User Guide*.
    """
    BlockDeviceMappings: List["EC2BlockDeviceMapping"] | None = None
    """
    Any block device mapping entries.
    """
    Description: str | None = None
    """
    The description of the AMI that was provided during image creation.
    """
    Hypervisor: Literal["ovm", "xen"] = Field(default=None, frozen=True)
    """
    The hypervisor type of the image.

    Only ``xen`` is supported. ``ovm`` is not supported.
    """
    Name: str | None = None
    """
    The name of the AMI that was provided during image creation.
    """
    Tags: List[Tag] = Field(default_factory=list, frozen=True)
    """
    Any tags assigned to the image.
    """
    TpmSupport: Literal["v2.0"] = Field(default=None, frozen=True)
    """
    If the image is configured for NitroTPM support, the value is ``v2.0``.

    For more information, see
    `NitroTPM <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitrotpm.html>`_
    in the *Amazon EC2 User Guide*.
    """
    SourceInstanceId: str = Field(default=None, frozen=True)
    """
The ID of the instance that the AMI was created from if the AMI was created using
`CreateImage <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateImage.html>`_. This field only appears if
the AMI was created using CreateImage.
    """
    DeregistrationProtection: str = Field(default=None, frozen=True)
    """
    Indicates whether deregistration protection is enabled for the AMI.
    """
    LastLaunchedTime: str = Field(default=None, frozen=True)
    """
The date and time, in `ISO 8601 date-time format <http://www.iso.org/iso/iso8601>`_, when the AMI was last used to launch
an EC2 instance. When the AMI is used to launch an instance, there is a 24-hour delay before that usage is reported.
    """
    ImageAllowed: bool = Field(default=None, frozen=True)
    """
    If ``true``, the AMI satisfies the criteria for Allowed AMIs and can be discovered
    and used in the account.

    If ``false``
    and Allowed AMIs is set to ``enabled``, the AMI can't be discovered or used in the account. If ``false`` and Allowed
    AMIs is set to ``audit-mode``, the AMI can be discovered and used in the account.
    """
    SourceImageId: str = Field(default=None, frozen=True)
    """
    The ID of the source AMI from which the AMI was created.
    """
    SourceImageRegion: str = Field(default=None, frozen=True)
    """
    The Region of the source AMI.
    """
    FreeTierEligible: bool = Field(default=None, frozen=True)
    """
    Indicates whether the image is eligible for Amazon Web Services Free Tier.
    """
    ImageLocation: str = Field(default=None, frozen=True)
    """
    The location of the AMI.
    """
    OwnerId: str = Field(default=None, frozen=True)
    """
    The ID of the Amazon Web Services account that owns the image.
    """
    CreationDate: str = Field(default=None, frozen=True)
    """
    The date and time the image was created.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`ImageId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.ImageId

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the :py:attr:`Name`
        attribute.

        Returns:
            The name of the model instance.
        """
        return self.Name

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`ImageId` attribute.
        """
        return hash(self.ImageId)

    @cached_property
    def instances(self) -> List["Instance"] | None:
        """
        Return the :py:class:`Instance` objects that are built from this image, 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(
                {
                    "Filters": [{"Name": "image-id", "Values": [self.ImageId]}],
                }
            )
        except AttributeError:
            return []
        return Instance.objects.using(self.session).list(**pk)  # type: ignore[arg-type]

    @cached_property
    def snapshot(self) -> Optional["Snapshot"]:
        """
        Return the :py:class:`Snapshot` object that is associated with this image.

        .. 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(
                {
                    "SnapshotId": self.BlockDeviceMappings[0].Ebs.SnapshotId,
                }
            )
        except AttributeError:
            return None
        return Snapshot.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    def enable_deregistration_protection(self) -> "str":
        """
        Enable deregistration protection for the AMI.
        """

        return (
            cast("AMIManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .enable_deregistration_protection(
                ImageId=self.ImageId, WithCooldown=False, DryRun=False
            )
        )

    def disable_deregistration_protection(self) -> "str":
        """
        Disable deregistration protection for the AMI.
        """

        return (
            cast("AMIManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .disable_deregistration_protection(ImageId=self.ImageId, DryRun=False)
        )


class OperatorResponse(Boto3Model):
    """
    Describes whether the resource is managed by a service provider and, if so,
    describes the service provider that manages it.
    """

    Managed: bool | None = None
    """
    If ``true``, the resource is managed by a service provider.
    """
    Principal: str | None = None
    """
    If ``managed`` is ``true``, then the principal is returned.

    The principal is the service provider that manages the resource.
    """


class EbsInstanceBlockDevice(Boto3Model):
    """
    Describes a parameter used to set up an EBS volume in a block device mapping.
    """

    Status: Literal["attaching", "attached", "detaching", "detached", "in-use"] | None = None
    """
    The attachment state.
    """
    AttachTime: datetime | None = None
    """
    The time stamp when the attachment initiated.
    """
    DeleteOnTermination: bool | None = None
    """
    Indicates whether the volume is deleted on instance termination.
    """
    VolumeId: str | None = None
    """
    The ID of the EBS volume.
    """
    AssociatedResource: str | None = None
    """
    The ARN of the Amazon Web Services-managed resource to which the volume is attached.
    """
    VolumeOwnerId: str | None = None
    """
    The ID of the Amazon Web Services account that owns the volume.
    """
    Operator: OperatorResponse | None = None
    """
    The service provider that manages the EBS volume.
    """


class InstanceBlockDeviceMapping(Boto3Model):
    """
    Describes a block device mapping.
    """

    DeviceName: str | None = None
    """
    The device name.
    """
    Ebs: EbsInstanceBlockDevice | None = None
    """
    Parameters used to automatically set up EBS volumes when the instance is launched.
    """


class EC2IamInstanceProfile(Boto3Model):
    """
    Describes an IAM instance profile.
    """

    Arn: str | None = None
    """
    The Amazon Resource Name (ARN) of the instance profile.
    """
    Id: str | None = None
    """
    The ID of the instance profile.
    """


class ElasticGpuAssociation(Boto3Model):
    """
    Amazon Elastic Graphics reached end of life on January 8, 2024.

    Describes the association between an instance and an Elastic Graphics accelerator.
    """

    ElasticGpuId: str | None = None
    """
    The ID of the Elastic Graphics accelerator.
    """
    ElasticGpuAssociationId: str | None = None
    """
    The ID of the association.
    """
    ElasticGpuAssociationState: str | None = None
    """
    The state of the association between the instance and the Elastic Graphics
    accelerator.
    """
    ElasticGpuAssociationTime: str | None = None
    """
    The time the Elastic Graphics accelerator was associated with the instance.
    """


class ElasticInferenceAcceleratorAssociation(Boto3Model):
    """
    Amazon Elastic Inference is no longer available.

    Describes the association between an instance and an elastic inference accelerator.
    """

    ElasticInferenceAcceleratorArn: str | None = None
    """
    The Amazon Resource Name (ARN) of the elastic inference accelerator.
    """
    ElasticInferenceAcceleratorAssociationId: str | None = None
    """
    The ID of the association.
    """
    ElasticInferenceAcceleratorAssociationState: str | None = None
    """
    The state of the elastic inference accelerator.
    """
    ElasticInferenceAcceleratorAssociationTime: datetime | None = None
    """
    The time at which the elastic inference accelerator is associated with an instance.
    """


class InstanceNetworkInterfaceAssociation(Boto3Model):
    """
    Describes association information for an Elastic IP address (IPv4).
    """

    CarrierIp: str | None = None
    """
    The carrier IP address associated with the network interface.
    """
    CustomerOwnedIp: str | None = None
    """
    The customer-owned IP address associated with the network interface.
    """
    IpOwnerId: str | None = None
    """
    The ID of the owner of the Elastic IP address.
    """
    PublicDnsName: str | None = None
    """
    The public DNS name.
    """
    PublicIp: str | None = None
    """
    The public IP address or Elastic IP address bound to the network interface.
    """


class InstanceAttachmentEnaSrdUdpSpecification(Boto3Model):
    """
    ENA Express is compatible with both TCP and UDP transport protocols.

    When it's enabled, TCP traffic automatically uses it. However, some UDP-based
    applications are designed to handle network packets that are out of order, without a
    need for retransmission, such as live video broadcasting or other near-real-time
    applications. For UDP traffic, you can specify whether to use ENA Express, based on
    your application environment needs.
    """

    EnaSrdUdpEnabled: bool | None = None
    """
    Indicates whether UDP traffic to and from the instance uses ENA Express.

    To specify this setting, you must first enable ENA Express.
    """


class InstanceAttachmentEnaSrdSpecification(Boto3Model):
    """
    ENA Express uses Amazon Web Services Scalable Reliable Datagram (SRD) technology to
    increase the maximum bandwidth used per stream and minimize tail latency of network
    traffic between EC2 instances. With ENA Express, you can communicate between two EC2
    instances in the same subnet within the same account, or in different accounts. Both
    sending and receiving instances must have ENA Express enabled.

    To improve the reliability of network packet delivery, ENA Express reorders network
    packets on the receiving end by default. However, some UDP-based applications are
    designed to handle network packets that are out of order to reduce the overhead for
    packet delivery at the network layer. When ENA Express is enabled, you can specify
    whether UDP network traffic uses it.
    """

    EnaSrdEnabled: bool | None = None
    """
    Indicates whether ENA Express is enabled for the network interface.
    """
    EnaSrdUdpSpecification: InstanceAttachmentEnaSrdUdpSpecification | None = None
    """
    Configures ENA Express for UDP network traffic.
    """


class InstanceNetworkInterfaceAttachment(Boto3Model):
    """
    Describes a network interface attachment.
    """

    AttachTime: datetime | None = None
    """
    The time stamp when the attachment initiated.
    """
    AttachmentId: str | None = None
    """
    The ID of the network interface attachment.
    """
    DeleteOnTermination: bool | None = None
    """
    Indicates whether the network interface is deleted when the instance is terminated.
    """
    DeviceIndex: int | None = None
    """
    The index of the device on the instance for the network interface attachment.
    """
    Status: Literal["attaching", "attached", "detaching", "detached"] | None = None
    """
    The attachment state.
    """
    NetworkCardIndex: int | None = None
    """
    The index of the network card.
    """
    EnaSrdSpecification: InstanceAttachmentEnaSrdSpecification | None = None
    """
    Contains the ENA Express settings for the network interface that's attached to the
    instance.
    """
    EnaQueueCount: int | None = None
    """
    The number of ENA queues created with the instance.
    """


class GroupIdentifier(Boto3Model):
    """
    Describes a security group.
    """

    GroupId: str | None = None
    """
    The ID of the security group.
    """
    GroupName: str | None = None
    """
    The name of the security group.
    """


class InstanceIpv6Address(Boto3Model):
    """
    Describes an IPv6 address.
    """

    Ipv6Address: str | None = None
    """
    The IPv6 address.
    """
    IsPrimaryIpv6: bool | None = None
    """
    Determines if an IPv6 address associated with a network interface is the primary
    IPv6 address.

    When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be
    made the primary IPv6 address until the instance is terminated or the network
    interface is detached. For more information, see
    `RunInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html>`_.
    """


class InstancePrivateIpAddress(Boto3Model):
    """
    Describes a private IPv4 address.
    """

    Association: InstanceNetworkInterfaceAssociation | None = None
    """
    The association information for an Elastic IP address for the network interface.
    """
    Primary: bool | None = None
    """
    Indicates whether this IPv4 address is the primary private IP address of the network
    interface.
    """
    PrivateDnsName: str | None = None
    """
    The private IPv4 DNS name.
    """
    PrivateIpAddress: str | None = None
    """
    The private IPv4 address of the network interface.
    """


class InstanceIpv4Prefix(Boto3Model):
    """
    Information about an IPv4 prefix.
    """

    Ipv4Prefix: str | None = None
    """
    One or more IPv4 prefixes assigned to the network interface.
    """


class InstanceIpv6Prefix(Boto3Model):
    """
    Information about an IPv6 prefix.
    """

    Ipv6Prefix: str | None = None
    """
    One or more IPv6 prefixes assigned to the network interface.
    """


class ConnectionTrackingSpecificationResponse(Boto3Model):
    """
    A security group connection tracking specification response that enables you to set
    the idle timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Connection tracking timeouts <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """

    TcpEstablishedTimeout: int | None = None
    """
    Timeout (in seconds) for idle TCP connections in an established state.

    Min: 60 seconds. Max: 432000 seconds (5 days).
    Default: 432000 seconds. Recommended: Less than 432000 seconds.
    """
    UdpStreamTimeout: int | None = None
    """
    Timeout (in seconds) for idle UDP flows classified as streams which have seen more
    than one request-response transaction.

    Min: 60 seconds. Max: 180 seconds (3 minutes). Default: 180 seconds.
    """
    UdpTimeout: int | None = None
    """
    Timeout (in seconds) for idle UDP flows that have seen traffic only in a single
    direction or a single request-response transaction.

    Min: 30 seconds. Max: 60 seconds. Default: 30 seconds.
    """


class InstanceNetworkInterface(Boto3Model):
    """
    Describes a network interface.
    """

    Association: InstanceNetworkInterfaceAssociation | None = None
    """
    The association information for an Elastic IPv4 associated with the network
    interface.
    """
    Attachment: InstanceNetworkInterfaceAttachment | None = None
    """
    The network interface attachment.
    """
    Description: str | None = None
    """
    The description.
    """
    Groups: List["GroupIdentifier"] | None = None
    """
    The security groups.
    """
    Ipv6Addresses: List["InstanceIpv6Address"] | None = None
    """
    The IPv6 addresses associated with the network interface.
    """
    MacAddress: str | None = None
    """
    The MAC address.
    """
    NetworkInterfaceId: str | None = None
    """
    The ID of the network interface.
    """
    OwnerId: str | None = None
    """
    The ID of the Amazon Web Services account that created the network interface.
    """
    PrivateDnsName: str | None = None
    """
    The private DNS name.
    """
    PrivateIpAddress: str | None = None
    """
    The IPv4 address of the network interface within the subnet.
    """
    PrivateIpAddresses: List["InstancePrivateIpAddress"] | None = None
    """
    The private IPv4 addresses associated with the network interface.
    """
    SourceDestCheck: bool | None = None
    """
    Indicates whether source/destination checking is enabled.
    """
    Status: Literal["available", "associated", "attaching", "in-use", "detaching"] | None = None
    """
    The status of the network interface.
    """
    SubnetId: str | None = None
    """
    The ID of the subnet.
    """
    VpcId: str | None = None
    """
    The ID of the VPC.
    """
    InterfaceType: str | None = None
    """
    The type of network interface.
    """
    Ipv4Prefixes: List["InstanceIpv4Prefix"] | None = None
    """
    The IPv4 delegated prefixes that are assigned to the network interface.
    """
    Ipv6Prefixes: List["InstanceIpv6Prefix"] | None = None
    """
    The IPv6 delegated prefixes that are assigned to the network interface.
    """
    ConnectionTrackingConfiguration: ConnectionTrackingSpecificationResponse | None = None
    """
    A security group connection tracking configuration that enables you to set the
    timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Connection tracking timeouts <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """
    Operator: OperatorResponse | None = None
    """
    The service provider that manages the network interface.
    """


class EC2CpuOptions(Boto3Model):
    """
    The CPU options for the instance.
    """

    CoreCount: int | None = None
    """
    The number of CPU cores for the instance.
    """
    ThreadsPerCore: int | None = None
    """
    The number of threads per CPU core.
    """
    AmdSevSnp: Literal["enabled", "disabled"] | None = None
    """
    Indicates whether the instance is enabled for AMD SEV-SNP.

    For more information, see `AMD SEV- SNP
    <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sev-snp.html>`_.
    """


class CapacityReservationTargetResponse(Boto3Model):
    """
    Describes a target Capacity Reservation or Capacity Reservation group.
    """

    CapacityReservationId: str | None = None
    """
    The ID of the targeted Capacity Reservation.
    """
    CapacityReservationResourceGroupArn: str | None = None
    """
    The ARN of the targeted Capacity Reservation group.
    """


class CapacityReservationSpecificationResponse(Boto3Model):
    """
    Describes the instance's Capacity Reservation targeting preferences.

    The action returns the
    ``capacityReservationPreference`` response element if the instance is configured to run in On-Demand capacity, or if it
    is configured in run in any ``open`` Capacity Reservation that has matching attributes (instance type, platform,
    Availability Zone). The action returns the ``capacityReservationTarget`` response element if the instance explicily
    targets a specific Capacity Reservation or Capacity Reservation group.
    """

    CapacityReservationPreference: Literal["capacity-reservations-only", "open", "none"] | None = None
    """
    Describes the instance's Capacity Reservation preferences.

    Possible preferences include:
    """
    CapacityReservationTarget: CapacityReservationTargetResponse | None = None
    """
    Information about the targeted Capacity Reservation or Capacity Reservation group.
    """


class EC2HibernationOptions(Boto3Model):
    """
    Indicates whether your instance is configured for hibernation.

    This parameter is valid only if the instance meets the
    `hibernation prerequisites <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html>`_.
    For    more information, see
    `Hibernate your Amazon EC2 instance <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html>`_
    in the *Amazon EC2 User Guide*.
    """

    Configured: bool | None = None
    """
    If ``true``, your instance is enabled for hibernation; otherwise, it is not enabled
    for hibernation.
    """


class LicenseConfiguration(Boto3Model):
    """
    Describes a license configuration.
    """

    LicenseConfigurationArn: str | None = None
    """
    The Amazon Resource Name (ARN) of the license configuration.
    """


class InstanceMetadataOptionsResponse(Boto3Model):
    """
    The metadata options for the instance.
    """

    State: Literal["pending", "applied"] | None = None
    """
    The state of the metadata option changes.
    """
    HttpTokens: Literal["optional", "required"] | None = None
    """
    Indicates whether IMDSv2 is required.
    """
    HttpPutResponseHopLimit: int | None = None
    """
    The maximum number of hops that the metadata token can travel.
    """
    HttpEndpoint: Literal["disabled", "enabled"] | None = None
    """
    Indicates whether the HTTP metadata endpoint on your instances is enabled or
    disabled.
    """
    HttpProtocolIpv6: Literal["disabled", "enabled"] | None = None
    """
    Indicates whether the IPv6 endpoint for the instance metadata service is enabled or
    disabled.
    """
    InstanceMetadataTags: Literal["disabled", "enabled"] | None = None
    """
    Indicates whether access to instance tags from the instance metadata is enabled or
    disabled.

    For more information, see
    `Work with instance tags using the instance metadata <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#work-with-tags-in-IMDS>`_.
    """


class EC2EnclaveOptions(Boto3Model):
    """
    Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.
    """

    Enabled: bool | None = None
    """
    If this parameter is set to ``true``, the instance is enabled for Amazon Web
    Services Nitro Enclaves; otherwise, it is not enabled for Amazon Web Services Nitro
    Enclaves.
    """


class PrivateDnsNameOptionsResponse(Boto3Model):
    """
    Describes the options for instance hostnames.
    """

    HostnameType: Literal["ip-name", "resource-name"] | None = None
    """
    The type of hostname to assign to an instance.
    """
    EnableResourceNameDnsARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS A
    records.
    """
    EnableResourceNameDnsAAAARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA
    records.
    """


class InstanceMaintenanceOptions(Boto3Model):
    """
    The maintenance options for the instance.
    """

    AutoRecovery: Literal["disabled", "default"] | None = None
    """
    Provides information on the current automatic recovery behavior of your instance.
    """
    RebootMigration: Literal["disabled", "default"] | None = None
    """
    Specifies whether to attempt reboot migration during a user-initiated reboot of an
    instance that has a scheduled ``system-reboot`` event:
    """


class InstanceNetworkPerformanceOptions(Boto3Model):
    """
    With network performance options, you can adjust your bandwidth preferences to meet
    the needs of the workload that runs on your instance.
    """

    BandwidthWeighting: Literal["default", "vpc-1", "ebs-1"] | None = None
    """
    When you configure network bandwidth weighting, you can boost your baseline
    bandwidth for either networking or EBS by up to 25%.

    The total available baseline bandwidth for your instance remains the same. The
    default option uses the standard bandwidth configuration for your instance type.
    """


class InstanceState(Boto3Model):
    """
    Describes the current state of an instance.
    """

    Code: int | None = None
    """
    The state of the instance as a 16-bit unsigned integer.
    """
    Name: Literal["pending", "running", "shutting-down", "terminated", "stopping", "stopped"] | None = None
    """
    The current state of the instance.
    """


class EC2Placement(Boto3Model):
    """
    Describes the placement of an instance.
    """

    AvailabilityZoneId: str | None = None
    """
    The ID of the Availability Zone of the instance.
    """
    Affinity: str | None = None
    """
    The affinity setting for the instance on the Dedicated Host.
    """
    GroupName: str | None = None
    """
    The name of the placement group that the instance is in.
    """
    PartitionNumber: int | None = None
    """
    The number of the partition that the instance is in.

    Valid only if the placement group strategy is set to ``partition``.
    """
    HostId: str | None = None
    """
    The ID of the Dedicated Host on which the instance resides.
    """
    Tenancy: Literal["default", "dedicated", "host"] | None = None
    """
    The tenancy of the instance.

    An instance with a tenancy of ``dedicated`` runs on single-tenant hardware.
    """
    SpreadDomain: str | None = None
    """
    Reserved for future use.
    """
    HostResourceGroupArn: str | None = None
    """
    The ARN of the host resource group in which to launch the instances.
    """
    GroupId: str | None = None
    """
    The ID of the placement group that the instance is in.
    """
    AvailabilityZone: str | None = None
    """
    The Availability Zone of the instance.
    """


class EC2DetailedMonitoring(Boto3Model):
    """
    Describes the monitoring of an instance.
    """

    State: Literal["disabled", "disabling", "enabled", "pending"] | None = None
    """
    Indicates whether detailed monitoring is enabled.

    Otherwise, basic monitoring is enabled.
    """


class Instance(TagsDictMixin, InstanceModelMixin, PrimaryBoto3Model):
    """
    Describes an instance.
    """

    tag_class: ClassVar[Type] = Tag
    manager_class: ClassVar[Type[Boto3ModelManager]] = InstanceManager

    Tags: List[Tag] | None = None
    """
    Any tags assigned to the instance.
    """
    Tunnels: Dict[str, List[Dict[str, Any]]] | None = None
    """
    The tunnels that are open for this instance.

    This is used by :py:meth:`start_tunnel` and :py:meth:`stop_tunnel`.
    """
    Architecture: Literal["i386", "x86_64", "arm64", "x86_64_mac", "arm64_mac"] = Field(
        default="x86_64", frozen=True
    )
    """
    The architecture of the image.
    """
    BlockDeviceMappings: List["InstanceBlockDeviceMapping"] | None = None
    """
    Any block device mapping entries for the instance.
    """
    ClientToken: str | None = None
    """
    The idempotency token you provided when you launched the instance, if applicable.
    """
    EbsOptimized: bool | None = None
    """
    Indicates whether the instance is optimized for Amazon EBS I/O.

    This optimization provides dedicated throughput to Amazon EBS and an optimized
    configuration stack to provide optimal I/O performance. This optimization isn't
    available with all instance types. Additional usage charges apply when using an EBS
    Optimized instance.
    """
    EnaSupport: bool = Field(default=None, frozen=True)
    """
    Specifies whether enhanced networking with ENA is enabled.
    """
    Hypervisor: Literal["ovm", "xen"] = Field(default=None, frozen=True)
    """
    The hypervisor type of the instance.

    The value ``xen`` is used for both Xen and Nitro hypervisors.
    """
    IamInstanceProfile: EC2IamInstanceProfile | None = None
    """
    The IAM instance profile associated with the instance, if applicable.
    """
    InstanceLifecycle: Literal["spot", "scheduled", "capacity-block"] = Field(
        default=None, frozen=True
    )
    """
    Indicates whether this is a Spot Instance or a Scheduled Instance.
    """
    ElasticGpuAssociations: List["ElasticGpuAssociation"] = Field(
        default_factory=list, frozen=True
    )
    """
    Deprecated.
    """
    ElasticInferenceAcceleratorAssociations: List[
        "ElasticInferenceAcceleratorAssociation"
    ] = Field(default_factory=list, frozen=True)
    """
    Deprecated.
    """
    NetworkInterfaces: List["InstanceNetworkInterface"] | None = None
    """
    The network interfaces for the instance.
    """
    OutpostArn: str = Field(default=None, frozen=True)
    """
    The Amazon Resource Name (ARN) of the Outpost.
    """
    RootDeviceName: str = Field(default=None, frozen=True)
    """
    The device name of the root device volume (for example, ``/dev/sda1``).
    """
    RootDeviceType: Literal["ebs", "instance-store"] = Field(default=None, frozen=True)
    """
    The root device type used by the AMI.

    The AMI can use an EBS volume or an instance store volume.
    """
    SecurityGroups: List["GroupIdentifier"] | None = None
    """
    The security groups for the instance.
    """
    SourceDestCheck: bool = Field(default=None, frozen=True)
    """
    Indicates whether source/destination checking is enabled.
    """
    SpotInstanceRequestId: str = Field(default=None, frozen=True)
    """
    If the request is a Spot Instance request, the ID of the request.
    """
    SriovNetSupport: str = Field(default=None, frozen=True)
    """
    Specifies whether enhanced networking with the Intel 82599 Virtual Function
    interface is enabled.
    """
    StateReason: EC2StateReason = Field(default=None, frozen=True)
    """
    The reason for the most recent state transition.
    """
    VirtualizationType: Literal["hvm", "paravirtual"] = Field(default=None, frozen=True)
    """
    The virtualization type of the instance.
    """
    CpuOptions: EC2CpuOptions | None = None
    """
    The CPU options for the instance.
    """
    CapacityBlockId: str = Field(default=None, frozen=True)
    """
    The ID of the Capacity Block.
    """
    CapacityReservationId: str = Field(default=None, frozen=True)
    """
    The ID of the Capacity Reservation.
    """
    CapacityReservationSpecification: CapacityReservationSpecificationResponse | None = None
    """
    Information about the Capacity Reservation targeting option.
    """
    HibernationOptions: EC2HibernationOptions | None = None
    """
    Indicates whether the instance is enabled for hibernation.
    """
    Licenses: List["LicenseConfiguration"] = Field(default_factory=list, frozen=True)
    """
    The license configurations for the instance.
    """
    MetadataOptions: InstanceMetadataOptionsResponse | None = None
    """
    The metadata options for the instance.
    """
    EnclaveOptions: EC2EnclaveOptions | None = None
    """
    Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.
    """
    BootMode: Literal["legacy-bios", "uefi", "uefi-preferred"] = Field(
        default=None, frozen=True
    )
    """
    The boot mode that was specified by the AMI.

    If the value is ``uefi-preferred``, the AMI supports both UEFI and Legacy
    BIOS. The ``currentInstanceBootMode`` parameter is the boot mode that is used to boot the instance at launch or start.
    """
    PlatformDetails: str = Field(default=None, frozen=True)
    """
    The platform details value for the instance.

    For more information, see
    `AMI billing information fields <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html>`_
    in the *Amazon EC2 User Guide*.
    """
    UsageOperation: str = Field(default=None, frozen=True)
    """
    The usage operation value for the instance.

    For more information, see
    `AMI billing information fields <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-info-fields.html>`_
    in the *Amazon EC2 User Guide*.
    """
    UsageOperationUpdateTime: datetime = Field(default=None, frozen=True)
    """
    The time that the usage operation was last updated.
    """
    PrivateDnsNameOptions: PrivateDnsNameOptionsResponse | None = None
    """
    The options for the instance hostname.
    """
    Ipv6Address: str = Field(default=None, frozen=True)
    """
    The IPv6 address assigned to the instance.
    """
    TpmSupport: str = Field(default=None, frozen=True)
    """
    If the instance is configured for NitroTPM support, the value is ``v2.0``.

    For more information, see
    `NitroTPM <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitrotpm.html>`_
    in the *Amazon EC2 User Guide*.
    """
    MaintenanceOptions: InstanceMaintenanceOptions | None = None
    """
    Provides information on the recovery and maintenance options of your instance.
    """
    CurrentInstanceBootMode: Literal["legacy-bios", "uefi"] = Field(
        default=None, frozen=True
    )
    """
    The boot mode that is used to boot the instance at launch or start.

    For more information, see
    `Boot modes <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html>`_
    in the *Amazon EC2 User Guide*.
    """
    NetworkPerformanceOptions: InstanceNetworkPerformanceOptions | None = None
    """
    Contains settings for the network performance options for your instance.
    """
    Operator: OperatorResponse | None = None
    """
    The service provider that manages the instance.
    """
    InstanceId: str = Field(default=None, frozen=True)
    """
    The ID of the instance.
    """
    ImageId: str | None = None
    """
    The ID of the AMI used to launch the instance.
    """
    State: InstanceState = Field(default=None, frozen=True)
    """
    The current state of the instance.
    """
    PrivateDnsName: str = Field(default=None, frozen=True)
    """
    [IPv4 only] The private DNS hostname name assigned to the instance.

    This DNS hostname can only be used inside the Amazon
    EC2 network. This name is not available until the instance enters the ``running`` state.
    """
    PublicDnsName: str = Field(default=None, frozen=True)
    """
    The public DNS name assigned to the instance.

    This name is not available until the instance enters the ``running``
    state. This name is only available if you've enabled DNS hostnames for your VPC. The format of this name depends on the
    `public hostname type <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hostname-types.html#public-hostnames>`_.
    """
    StateTransitionReason: str = Field(default=None, frozen=True)
    """
    The reason for the most recent state transition.

    This might be an empty string.
    """
    KeyName: str | None = None
    """
    The name of the key pair, if this instance was launched with an associated key pair.
    """
    AmiLaunchIndex: int = Field(default=None, frozen=True)
    """
    The AMI launch index, which can be used to find this instance in the launch group.
    """
    ProductCodes: List["ProductCode"] = Field(default_factory=list, frozen=True)
    """
    The product codes attached to this instance, if applicable.
    """
    InstanceType: Literal["a1.medium", "a1.large", "a1.xlarge", "a1.2xlarge", "a1.4xlarge", "a1.metal", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge", "c5.large", "c5.xlarge", "c5.2xlarge", "c5.4xlarge", "c5.9xlarge", "c5.12xlarge", "c5.18xlarge", "c5.24xlarge", "c5.metal", "c5a.large", "c5a.xlarge", "c5a.2xlarge", "c5a.4xlarge", "c5a.8xlarge", "c5a.12xlarge", "c5a.16xlarge", "c5a.24xlarge", "c5ad.large", "c5ad.xlarge", "c5ad.2xlarge", "c5ad.4xlarge", "c5ad.8xlarge", "c5ad.12xlarge", "c5ad.16xlarge", "c5ad.24xlarge", "c5d.large", "c5d.xlarge", "c5d.2xlarge", "c5d.4xlarge", "c5d.9xlarge", "c5d.12xlarge", "c5d.18xlarge", "c5d.24xlarge", "c5d.metal", "c5n.large", "c5n.xlarge", "c5n.2xlarge", "c5n.4xlarge", "c5n.9xlarge", "c5n.18xlarge", "c5n.metal", "c6g.medium", "c6g.large", "c6g.xlarge", "c6g.2xlarge", "c6g.4xlarge", "c6g.8xlarge", "c6g.12xlarge", "c6g.16xlarge", "c6g.metal", "c6gd.medium", "c6gd.large", "c6gd.xlarge", "c6gd.2xlarge", "c6gd.4xlarge", "c6gd.8xlarge", "c6gd.12xlarge", "c6gd.16xlarge", "c6gd.metal", "c6gn.medium", "c6gn.large", "c6gn.xlarge", "c6gn.2xlarge", "c6gn.4xlarge", "c6gn.8xlarge", "c6gn.12xlarge", "c6gn.16xlarge", "c6i.large", "c6i.xlarge", "c6i.2xlarge", "c6i.4xlarge", "c6i.8xlarge", "c6i.12xlarge", "c6i.16xlarge", "c6i.24xlarge", "c6i.32xlarge", "c6i.metal", "cc1.4xlarge", "cc2.8xlarge", "cg1.4xlarge", "cr1.8xlarge", "d2.xlarge", "d2.2xlarge", "d2.4xlarge", "d2.8xlarge", "d3.xlarge", "d3.2xlarge", "d3.4xlarge", "d3.8xlarge", "d3en.xlarge", "d3en.2xlarge", "d3en.4xlarge", "d3en.6xlarge", "d3en.8xlarge", "d3en.12xlarge", "dl1.24xlarge", "f1.2xlarge", "f1.4xlarge", "f1.16xlarge", "g2.2xlarge", "g2.8xlarge", "g3.4xlarge", "g3.8xlarge", "g3.16xlarge", "g3s.xlarge", "g4ad.xlarge", "g4ad.2xlarge", "g4ad.4xlarge", "g4ad.8xlarge", "g4ad.16xlarge", "g4dn.xlarge", "g4dn.2xlarge", "g4dn.4xlarge", "g4dn.8xlarge", "g4dn.12xlarge", "g4dn.16xlarge", "g4dn.metal", "g5.xlarge", "g5.2xlarge", "g5.4xlarge", "g5.8xlarge", "g5.12xlarge", "g5.16xlarge", "g5.24xlarge", "g5.48xlarge", "g5g.xlarge", "g5g.2xlarge", "g5g.4xlarge", "g5g.8xlarge", "g5g.16xlarge", "g5g.metal", "hi1.4xlarge", "hpc6a.48xlarge", "hs1.8xlarge", "h1.2xlarge", "h1.4xlarge", "h1.8xlarge", "h1.16xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "i3.large", "i3.xlarge", "i3.2xlarge", "i3.4xlarge", "i3.8xlarge", "i3.16xlarge", "i3.metal", "i3en.large", "i3en.xlarge", "i3en.2xlarge", "i3en.3xlarge", "i3en.6xlarge", "i3en.12xlarge", "i3en.24xlarge", "i3en.metal", "im4gn.large", "im4gn.xlarge", "im4gn.2xlarge", "im4gn.4xlarge", "im4gn.8xlarge", "im4gn.16xlarge", "inf1.xlarge", "inf1.2xlarge", "inf1.6xlarge", "inf1.24xlarge", "is4gen.medium", "is4gen.large", "is4gen.xlarge", "is4gen.2xlarge", "is4gen.4xlarge", "is4gen.8xlarge", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "m4.large", "m4.xlarge", "m4.2xlarge", "m4.4xlarge", "m4.10xlarge", "m4.16xlarge", "m5.large", "m5.xlarge", "m5.2xlarge", "m5.4xlarge", "m5.8xlarge", "m5.12xlarge", "m5.16xlarge", "m5.24xlarge", "m5.metal", "m5a.large", "m5a.xlarge", "m5a.2xlarge", "m5a.4xlarge", "m5a.8xlarge", "m5a.12xlarge", "m5a.16xlarge", "m5a.24xlarge", "m5ad.large", "m5ad.xlarge", "m5ad.2xlarge", "m5ad.4xlarge", "m5ad.8xlarge", "m5ad.12xlarge", "m5ad.16xlarge", "m5ad.24xlarge", "m5d.large", "m5d.xlarge", "m5d.2xlarge", "m5d.4xlarge", "m5d.8xlarge", "m5d.12xlarge", "m5d.16xlarge", "m5d.24xlarge", "m5d.metal", "m5dn.large", "m5dn.xlarge", "m5dn.2xlarge", "m5dn.4xlarge", "m5dn.8xlarge", "m5dn.12xlarge", "m5dn.16xlarge", "m5dn.24xlarge", "m5dn.metal", "m5n.large", "m5n.xlarge", "m5n.2xlarge", "m5n.4xlarge", "m5n.8xlarge", "m5n.12xlarge", "m5n.16xlarge", "m5n.24xlarge", "m5n.metal", "m5zn.large", "m5zn.xlarge", "m5zn.2xlarge", "m5zn.3xlarge", "m5zn.6xlarge", "m5zn.12xlarge", "m5zn.metal", "m6a.large", "m6a.xlarge", "m6a.2xlarge", "m6a.4xlarge", "m6a.8xlarge", "m6a.12xlarge", "m6a.16xlarge", "m6a.24xlarge", "m6a.32xlarge", "m6a.48xlarge", "m6g.metal", "m6g.medium", "m6g.large", "m6g.xlarge", "m6g.2xlarge", "m6g.4xlarge", "m6g.8xlarge", "m6g.12xlarge", "m6g.16xlarge", "m6gd.metal", "m6gd.medium", "m6gd.large", "m6gd.xlarge", "m6gd.2xlarge", "m6gd.4xlarge", "m6gd.8xlarge", "m6gd.12xlarge", "m6gd.16xlarge", "m6i.large", "m6i.xlarge", "m6i.2xlarge", "m6i.4xlarge", "m6i.8xlarge", "m6i.12xlarge", "m6i.16xlarge", "m6i.24xlarge", "m6i.32xlarge", "m6i.metal", "mac1.metal", "p2.xlarge", "p2.8xlarge", "p2.16xlarge", "p3.2xlarge", "p3.8xlarge", "p3.16xlarge", "p3dn.24xlarge", "p4d.24xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "r4.large", "r4.xlarge", "r4.2xlarge", "r4.4xlarge", "r4.8xlarge", "r4.16xlarge", "r5.large", "r5.xlarge", "r5.2xlarge", "r5.4xlarge", "r5.8xlarge", "r5.12xlarge", "r5.16xlarge", "r5.24xlarge", "r5.metal", "r5a.large", "r5a.xlarge", "r5a.2xlarge", "r5a.4xlarge", "r5a.8xlarge", "r5a.12xlarge", "r5a.16xlarge", "r5a.24xlarge", "r5ad.large", "r5ad.xlarge", "r5ad.2xlarge", "r5ad.4xlarge", "r5ad.8xlarge", "r5ad.12xlarge", "r5ad.16xlarge", "r5ad.24xlarge", "r5b.large", "r5b.xlarge", "r5b.2xlarge", "r5b.4xlarge", "r5b.8xlarge", "r5b.12xlarge", "r5b.16xlarge", "r5b.24xlarge", "r5b.metal", "r5d.large", "r5d.xlarge", "r5d.2xlarge", "r5d.4xlarge", "r5d.8xlarge", "r5d.12xlarge", "r5d.16xlarge", "r5d.24xlarge", "r5d.metal", "r5dn.large", "r5dn.xlarge", "r5dn.2xlarge", "r5dn.4xlarge", "r5dn.8xlarge", "r5dn.12xlarge", "r5dn.16xlarge", "r5dn.24xlarge", "r5dn.metal", "r5n.large", "r5n.xlarge", "r5n.2xlarge", "r5n.4xlarge", "r5n.8xlarge", "r5n.12xlarge", "r5n.16xlarge", "r5n.24xlarge", "r5n.metal", "r6g.medium", "r6g.large", "r6g.xlarge", "r6g.2xlarge", "r6g.4xlarge", "r6g.8xlarge", "r6g.12xlarge", "r6g.16xlarge", "r6g.metal", "r6gd.medium", "r6gd.large", "r6gd.xlarge", "r6gd.2xlarge", "r6gd.4xlarge", "r6gd.8xlarge", "r6gd.12xlarge", "r6gd.16xlarge", "r6gd.metal", "r6i.large", "r6i.xlarge", "r6i.2xlarge", "r6i.4xlarge", "r6i.8xlarge", "r6i.12xlarge", "r6i.16xlarge", "r6i.24xlarge", "r6i.32xlarge", "r6i.metal", "t1.micro", "t2.nano", "t2.micro", "t2.small", "t2.medium", "t2.large", "t2.xlarge", "t2.2xlarge", "t3.nano", "t3.micro", "t3.small", "t3.medium", "t3.large", "t3.xlarge", "t3.2xlarge", "t3a.nano", "t3a.micro", "t3a.small", "t3a.medium", "t3a.large", "t3a.xlarge", "t3a.2xlarge", "t4g.nano", "t4g.micro", "t4g.small", "t4g.medium", "t4g.large", "t4g.xlarge", "t4g.2xlarge", "u-6tb1.56xlarge", "u-6tb1.112xlarge", "u-9tb1.112xlarge", "u-12tb1.112xlarge", "u-6tb1.metal", "u-9tb1.metal", "u-12tb1.metal", "u-18tb1.metal", "u-24tb1.metal", "vt1.3xlarge", "vt1.6xlarge", "vt1.24xlarge", "x1.16xlarge", "x1.32xlarge", "x1e.xlarge", "x1e.2xlarge", "x1e.4xlarge", "x1e.8xlarge", "x1e.16xlarge", "x1e.32xlarge", "x2iezn.2xlarge", "x2iezn.4xlarge", "x2iezn.6xlarge", "x2iezn.8xlarge", "x2iezn.12xlarge", "x2iezn.metal", "x2gd.medium", "x2gd.large", "x2gd.xlarge", "x2gd.2xlarge", "x2gd.4xlarge", "x2gd.8xlarge", "x2gd.12xlarge", "x2gd.16xlarge", "x2gd.metal", "z1d.large", "z1d.xlarge", "z1d.2xlarge", "z1d.3xlarge", "z1d.6xlarge", "z1d.12xlarge", "z1d.metal", "x2idn.16xlarge", "x2idn.24xlarge", "x2idn.32xlarge", "x2iedn.xlarge", "x2iedn.2xlarge", "x2iedn.4xlarge", "x2iedn.8xlarge", "x2iedn.16xlarge", "x2iedn.24xlarge", "x2iedn.32xlarge", "c6a.large", "c6a.xlarge", "c6a.2xlarge", "c6a.4xlarge", "c6a.8xlarge", "c6a.12xlarge", "c6a.16xlarge", "c6a.24xlarge", "c6a.32xlarge", "c6a.48xlarge", "c6a.metal", "m6a.metal", "i4i.large", "i4i.xlarge", "i4i.2xlarge", "i4i.4xlarge", "i4i.8xlarge", "i4i.16xlarge", "i4i.32xlarge", "i4i.metal", "x2idn.metal", "x2iedn.metal", "c7g.medium", "c7g.large", "c7g.xlarge", "c7g.2xlarge", "c7g.4xlarge", "c7g.8xlarge", "c7g.12xlarge", "c7g.16xlarge", "mac2.metal", "c6id.large", "c6id.xlarge", "c6id.2xlarge", "c6id.4xlarge", "c6id.8xlarge", "c6id.12xlarge", "c6id.16xlarge", "c6id.24xlarge", "c6id.32xlarge", "c6id.metal", "m6id.large", "m6id.xlarge", "m6id.2xlarge", "m6id.4xlarge", "m6id.8xlarge", "m6id.12xlarge", "m6id.16xlarge", "m6id.24xlarge", "m6id.32xlarge", "m6id.metal", "r6id.large", "r6id.xlarge", "r6id.2xlarge", "r6id.4xlarge", "r6id.8xlarge", "r6id.12xlarge", "r6id.16xlarge", "r6id.24xlarge", "r6id.32xlarge", "r6id.metal", "r6a.large", "r6a.xlarge", "r6a.2xlarge", "r6a.4xlarge", "r6a.8xlarge", "r6a.12xlarge", "r6a.16xlarge", "r6a.24xlarge", "r6a.32xlarge", "r6a.48xlarge", "r6a.metal", "p4de.24xlarge", "u-3tb1.56xlarge", "u-18tb1.112xlarge", "u-24tb1.112xlarge", "trn1.2xlarge", "trn1.32xlarge", "hpc6id.32xlarge", "c6in.large", "c6in.xlarge", "c6in.2xlarge", "c6in.4xlarge", "c6in.8xlarge", "c6in.12xlarge", "c6in.16xlarge", "c6in.24xlarge", "c6in.32xlarge", "m6in.large", "m6in.xlarge", "m6in.2xlarge", "m6in.4xlarge", "m6in.8xlarge", "m6in.12xlarge", "m6in.16xlarge", "m6in.24xlarge", "m6in.32xlarge", "m6idn.large", "m6idn.xlarge", "m6idn.2xlarge", "m6idn.4xlarge", "m6idn.8xlarge", "m6idn.12xlarge", "m6idn.16xlarge", "m6idn.24xlarge", "m6idn.32xlarge", "r6in.large", "r6in.xlarge", "r6in.2xlarge", "r6in.4xlarge", "r6in.8xlarge", "r6in.12xlarge", "r6in.16xlarge", "r6in.24xlarge", "r6in.32xlarge", "r6idn.large", "r6idn.xlarge", "r6idn.2xlarge", "r6idn.4xlarge", "r6idn.8xlarge", "r6idn.12xlarge", "r6idn.16xlarge", "r6idn.24xlarge", "r6idn.32xlarge", "c7g.metal", "m7g.medium", "m7g.large", "m7g.xlarge", "m7g.2xlarge", "m7g.4xlarge", "m7g.8xlarge", "m7g.12xlarge", "m7g.16xlarge", "m7g.metal", "r7g.medium", "r7g.large", "r7g.xlarge", "r7g.2xlarge", "r7g.4xlarge", "r7g.8xlarge", "r7g.12xlarge", "r7g.16xlarge", "r7g.metal", "c6in.metal", "m6in.metal", "m6idn.metal", "r6in.metal", "r6idn.metal", "inf2.xlarge", "inf2.8xlarge", "inf2.24xlarge", "inf2.48xlarge", "trn1n.32xlarge", "i4g.large", "i4g.xlarge", "i4g.2xlarge", "i4g.4xlarge", "i4g.8xlarge", "i4g.16xlarge", "hpc7g.4xlarge", "hpc7g.8xlarge", "hpc7g.16xlarge", "c7gn.medium", "c7gn.large", "c7gn.xlarge", "c7gn.2xlarge", "c7gn.4xlarge", "c7gn.8xlarge", "c7gn.12xlarge", "c7gn.16xlarge", "p5.48xlarge", "m7i.large", "m7i.xlarge", "m7i.2xlarge", "m7i.4xlarge", "m7i.8xlarge", "m7i.12xlarge", "m7i.16xlarge", "m7i.24xlarge", "m7i.48xlarge", "m7i-flex.large", "m7i-flex.xlarge", "m7i-flex.2xlarge", "m7i-flex.4xlarge", "m7i-flex.8xlarge", "m7a.medium", "m7a.large", "m7a.xlarge", "m7a.2xlarge", "m7a.4xlarge", "m7a.8xlarge", "m7a.12xlarge", "m7a.16xlarge", "m7a.24xlarge", "m7a.32xlarge", "m7a.48xlarge", "m7a.metal-48xl", "hpc7a.12xlarge", "hpc7a.24xlarge", "hpc7a.48xlarge", "hpc7a.96xlarge", "c7gd.medium", "c7gd.large", "c7gd.xlarge", "c7gd.2xlarge", "c7gd.4xlarge", "c7gd.8xlarge", "c7gd.12xlarge", "c7gd.16xlarge", "m7gd.medium", "m7gd.large", "m7gd.xlarge", "m7gd.2xlarge", "m7gd.4xlarge", "m7gd.8xlarge", "m7gd.12xlarge", "m7gd.16xlarge", "r7gd.medium", "r7gd.large", "r7gd.xlarge", "r7gd.2xlarge", "r7gd.4xlarge", "r7gd.8xlarge", "r7gd.12xlarge", "r7gd.16xlarge", "r7a.medium", "r7a.large", "r7a.xlarge", "r7a.2xlarge", "r7a.4xlarge", "r7a.8xlarge", "r7a.12xlarge", "r7a.16xlarge", "r7a.24xlarge", "r7a.32xlarge", "r7a.48xlarge", "c7i.large", "c7i.xlarge", "c7i.2xlarge", "c7i.4xlarge", "c7i.8xlarge", "c7i.12xlarge", "c7i.16xlarge", "c7i.24xlarge", "c7i.48xlarge", "mac2-m2pro.metal", "r7iz.large", "r7iz.xlarge", "r7iz.2xlarge", "r7iz.4xlarge", "r7iz.8xlarge", "r7iz.12xlarge", "r7iz.16xlarge", "r7iz.32xlarge", "c7a.medium", "c7a.large", "c7a.xlarge", "c7a.2xlarge", "c7a.4xlarge", "c7a.8xlarge", "c7a.12xlarge", "c7a.16xlarge", "c7a.24xlarge", "c7a.32xlarge", "c7a.48xlarge", "c7a.metal-48xl", "r7a.metal-48xl", "r7i.large", "r7i.xlarge", "r7i.2xlarge", "r7i.4xlarge", "r7i.8xlarge", "r7i.12xlarge", "r7i.16xlarge", "r7i.24xlarge", "r7i.48xlarge", "dl2q.24xlarge", "mac2-m2.metal", "i4i.12xlarge", "i4i.24xlarge", "c7i.metal-24xl", "c7i.metal-48xl", "m7i.metal-24xl", "m7i.metal-48xl", "r7i.metal-24xl", "r7i.metal-48xl", "r7iz.metal-16xl", "r7iz.metal-32xl", "c7gd.metal", "m7gd.metal", "r7gd.metal", "g6.xlarge", "g6.2xlarge", "g6.4xlarge", "g6.8xlarge", "g6.12xlarge", "g6.16xlarge", "g6.24xlarge", "g6.48xlarge", "gr6.4xlarge", "gr6.8xlarge", "c7i-flex.large", "c7i-flex.xlarge", "c7i-flex.2xlarge", "c7i-flex.4xlarge", "c7i-flex.8xlarge", "u7i-12tb.224xlarge", "u7in-16tb.224xlarge", "u7in-24tb.224xlarge", "u7in-32tb.224xlarge", "u7ib-12tb.224xlarge", "c7gn.metal", "r8g.medium", "r8g.large", "r8g.xlarge", "r8g.2xlarge", "r8g.4xlarge", "r8g.8xlarge", "r8g.12xlarge", "r8g.16xlarge", "r8g.24xlarge", "r8g.48xlarge", "r8g.metal-24xl", "r8g.metal-48xl", "mac2-m1ultra.metal", "g6e.xlarge", "g6e.2xlarge", "g6e.4xlarge", "g6e.8xlarge", "g6e.12xlarge", "g6e.16xlarge", "g6e.24xlarge", "g6e.48xlarge", "c8g.medium", "c8g.large", "c8g.xlarge", "c8g.2xlarge", "c8g.4xlarge", "c8g.8xlarge", "c8g.12xlarge", "c8g.16xlarge", "c8g.24xlarge", "c8g.48xlarge", "c8g.metal-24xl", "c8g.metal-48xl", "m8g.medium", "m8g.large", "m8g.xlarge", "m8g.2xlarge", "m8g.4xlarge", "m8g.8xlarge", "m8g.12xlarge", "m8g.16xlarge", "m8g.24xlarge", "m8g.48xlarge", "m8g.metal-24xl", "m8g.metal-48xl", "x8g.medium", "x8g.large", "x8g.xlarge", "x8g.2xlarge", "x8g.4xlarge", "x8g.8xlarge", "x8g.12xlarge", "x8g.16xlarge", "x8g.24xlarge", "x8g.48xlarge", "x8g.metal-24xl", "x8g.metal-48xl", "i7ie.large", "i7ie.xlarge", "i7ie.2xlarge", "i7ie.3xlarge", "i7ie.6xlarge", "i7ie.12xlarge", "i7ie.18xlarge", "i7ie.24xlarge", "i7ie.48xlarge", "i8g.large", "i8g.xlarge", "i8g.2xlarge", "i8g.4xlarge", "i8g.8xlarge", "i8g.12xlarge", "i8g.16xlarge", "i8g.24xlarge", "i8g.metal-24xl", "u7i-6tb.112xlarge", "u7i-8tb.112xlarge", "u7inh-32tb.480xlarge", "p5e.48xlarge", "p5en.48xlarge", "f2.12xlarge", "f2.48xlarge", "trn2.48xlarge", "c7i-flex.12xlarge", "c7i-flex.16xlarge", "m7i-flex.12xlarge", "m7i-flex.16xlarge", "i7ie.metal-24xl", "i7ie.metal-48xl", "i8g.48xlarge", "c8gd.medium", "c8gd.large", "c8gd.xlarge", "c8gd.2xlarge", "c8gd.4xlarge", "c8gd.8xlarge", "c8gd.12xlarge", "c8gd.16xlarge", "c8gd.24xlarge", "c8gd.48xlarge", "c8gd.metal-24xl", "c8gd.metal-48xl", "i7i.large", "i7i.xlarge", "i7i.2xlarge", "i7i.4xlarge", "i7i.8xlarge", "i7i.12xlarge", "i7i.16xlarge", "i7i.24xlarge", "i7i.48xlarge", "i7i.metal-24xl", "i7i.metal-48xl", "p6-b200.48xlarge", "m8gd.medium", "m8gd.large", "m8gd.xlarge", "m8gd.2xlarge", "m8gd.4xlarge", "m8gd.8xlarge", "m8gd.12xlarge", "m8gd.16xlarge", "m8gd.24xlarge", "m8gd.48xlarge", "m8gd.metal-24xl", "m8gd.metal-48xl", "r8gd.medium", "r8gd.large", "r8gd.xlarge", "r8gd.2xlarge", "r8gd.4xlarge", "r8gd.8xlarge", "r8gd.12xlarge", "r8gd.16xlarge", "r8gd.24xlarge", "r8gd.48xlarge", "r8gd.metal-24xl", "r8gd.metal-48xl", "c8gn.medium", "c8gn.large", "c8gn.xlarge", "c8gn.2xlarge", "c8gn.4xlarge", "c8gn.8xlarge", "c8gn.12xlarge", "c8gn.16xlarge", "c8gn.24xlarge", "c8gn.48xlarge", "c8gn.metal-24xl", "c8gn.metal-48xl", "f2.6xlarge", "p6e-gb200.36xlarge", "g6f.large", "g6f.xlarge", "g6f.2xlarge", "g6f.4xlarge", "gr6f.4xlarge", "p5.4xlarge", "r8i.large", "r8i.xlarge", "r8i.2xlarge", "r8i.4xlarge", "r8i.8xlarge", "r8i.12xlarge", "r8i.16xlarge", "r8i.24xlarge", "r8i.32xlarge", "r8i.48xlarge", "r8i.96xlarge", "r8i.metal-48xl", "r8i.metal-96xl", "r8i-flex.large", "r8i-flex.xlarge", "r8i-flex.2xlarge", "r8i-flex.4xlarge", "r8i-flex.8xlarge", "r8i-flex.12xlarge", "r8i-flex.16xlarge", "m8i.large", "m8i.xlarge", "m8i.2xlarge", "m8i.4xlarge", "m8i.8xlarge", "m8i.12xlarge", "m8i.16xlarge", "m8i.24xlarge", "m8i.32xlarge", "m8i.48xlarge", "m8i.96xlarge", "m8i.metal-48xl", "m8i.metal-96xl", "m8i-flex.large", "m8i-flex.xlarge", "m8i-flex.2xlarge", "m8i-flex.4xlarge", "m8i-flex.8xlarge", "m8i-flex.12xlarge", "m8i-flex.16xlarge", "i8ge.large", "i8ge.xlarge", "i8ge.2xlarge", "i8ge.3xlarge", "i8ge.6xlarge", "i8ge.12xlarge", "i8ge.18xlarge", "i8ge.24xlarge", "i8ge.48xlarge", "i8ge.metal-24xl", "i8ge.metal-48xl", "mac-m4.metal", "mac-m4pro.metal", "r8gn.medium", "r8gn.large", "r8gn.xlarge", "r8gn.2xlarge", "r8gn.4xlarge", "r8gn.8xlarge", "r8gn.12xlarge", "r8gn.16xlarge", "r8gn.24xlarge", "r8gn.48xlarge", "r8gn.metal-24xl", "r8gn.metal-48xl"] | None = None
    """
    The instance type.
    """
    LaunchTime: datetime = Field(default=None, frozen=True)
    """
    The time that the instance was last launched.

    To determine the time that instance was first launched, see the attachment time for
    the primary network interface.
    """
    Placement: EC2Placement | None = None
    """
    The location where the instance launched, if applicable.
    """
    KernelId: str | None = None
    """
    The kernel associated with this instance, if applicable.
    """
    RamdiskId: str | None = None
    """
    The RAM disk associated with this instance, if applicable.
    """
    Platform: Literal["Windows"] = Field(default=None, frozen=True)
    """
    The platform.

    This value is ``windows`` for Windows instances; otherwise, it is empty.
    """
    Monitoring: EC2DetailedMonitoring | None = None
    """
    The monitoring for the instance.
    """
    SubnetId: str | None = None
    """
    The ID of the subnet in which the instance is running.
    """
    VpcId: str = Field(default=None, frozen=True)
    """
    The ID of the VPC in which the instance is running.
    """
    PrivateIpAddress: str | None = None
    """
    The private IPv4 address assigned to the instance.
    """
    PublicIpAddress: str = Field(default=None, frozen=True)
    """
    The public IPv4 address, or the Carrier IP address assigned to the instance, if
    applicable.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`InstanceId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.InstanceId

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the
        :py:attr:`self.tags["Name"] if "Name" in self.tags else None` attribute.

        Returns:
            The name of the model instance.
        """
        return self.self.tags["Name"] if "Name" in self.tags else None

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`InstanceId` attribute.
        """
        return hash(self.InstanceId)

    @cached_property
    def ami(self) -> Optional["AMI"]:
        """
        Return the :py:class:`AMI` object that this instance is built from, 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(
                {
                    "ImageId": self.ImageId,
                }
            )
        except AttributeError:
            return None
        return AMI.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def vpc(self) -> Optional["Vpc"]:
        """
        Return the :py:class:`Vpc` object that this instance belongs to, 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(
                {
                    "VpcId": self.VpcId,
                }
            )
        except AttributeError:
            return None
        return Vpc.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def subnet(self) -> Optional["Subnet"]:
        """
        Return the :py:class:`Subnet` object that this instance belongs to, 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(
                {
                    "SubnetId": self.SubnetId,
                }
            )
        except AttributeError:
            return None
        return Subnet.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def security_groups(self) -> List["SecurityGroup"] | None:
        """
        Return the :py:class:`SecurityGroup` objects that this instance belongs to, 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(
                {
                    "GroupIds": [
                        identifier.GroupId
                        for identifier in cast(
                            "List[GroupIdentifier]", self.SecurityGroups
                        )
                    ],
                }
            )
        except AttributeError:
            return []
        return SecurityGroup.objects.using(self.session).list(**pk)  # type: ignore[arg-type]

    @cached_property
    def network_interfaces(self) -> List["NetworkInterface"] | None:
        """
        Return the :py:class:`NetworkInterface` objects that this instance has, 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(
                {
                    "Filters": [
                        {"Name": "attachment.instance-id", "Values": [self.InstanceId]}
                    ],
                }
            )
        except AttributeError:
            return []
        return NetworkInterface.objects.using(self.session).list(**pk)  # type: ignore[arg-type]

    @cached_property
    def instance_type(self) -> Optional["EC2InstanceType"]:
        """
        Return the :py:class:`EC2InstanceType` object that this instance runs on.

        .. 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]

    def start(self, DryRun: bool = False) -> List["InstanceStateChange"] | None:
        """
        Start the instance.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """

        return (
            cast("InstanceManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .start([self.InstanceId], DryRun=DryRun)
        )

    def stop(
        self,
        DryRun: bool = False,
        Hibernate: bool | None = None,
        Force: bool | None = None,
    ) -> List["InstanceStateChange"] | None:
        """
        Stop the instance.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            Hibernate: Hibernates the instance if the instance was enabled for hibernation at launch. If the instance cannot
                hibernate successfully, a normal shutdown occurs. For more information, see `Hibernate your Amazon EC2 instance
                <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html>`_ in the *Amazon EC2 User Guide*.
            Force: Forces the instance to stop. The instance will first attempt a graceful shutdown, which includes flushing
                file system caches and metadata. If the graceful shutdown fails to complete within the timeout period, the instance
                shuts down forcibly without flushing the file system caches and metadata.
        """

        return (
            cast("InstanceManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .stop([self.InstanceId], DryRun=DryRun, Hibernate=Hibernate, Force=Force)
        )

    def reboot(self, DryRun: bool = False) -> "None":
        """
        Reboot the instance.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """

        return (
            cast("InstanceManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .reboot([self.InstanceId], DryRun=DryRun)
        )

    def terminate(self, DryRun: bool = False) -> List["InstanceStateChange"] | None:
        """
        Terminate the instance.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the operation, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """

        return (
            cast("InstanceManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .terminate([self.InstanceId], DryRun=DryRun)
        )


class LaunchTemplate(TagsDictMixin, PrimaryBoto3Model):
    """
    Describes a launch template.
    """

    tag_class: ClassVar[Type] = Tag
    manager_class: ClassVar[Type[Boto3ModelManager]] = LaunchTemplateManager

    LaunchTemplateName: str
    """
    The name of the launch template.
    """
    LaunchTemplateId: str = Field(default=None, frozen=True)
    """
    The ID of the launch template.
    """
    CreateTime: datetime = Field(default=None, frozen=True)
    """
    The time launch template was created.
    """
    CreatedBy: str = Field(default=None, frozen=True)
    """
    The principal that created the launch template.
    """
    DefaultVersionNumber: int = Field(default=None, frozen=True)
    """
    The version number of the default version of the launch template.
    """
    LatestVersionNumber: int = Field(default=None, frozen=True)
    """
    The version number of the latest version of the launch template.
    """
    Tags: List[Tag] = Field(default_factory=list, frozen=True)
    """
    The tags for the launch template.
    """
    Operator: OperatorResponse | None = None
    """
    The entity that manages the launch template.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`LaunchTemplateId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.LaunchTemplateId

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the
        :py:attr:`LaunchTemplateName` attribute.

        Returns:
            The name of the model instance.
        """
        return self.LaunchTemplateName

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`LaunchTemplateId` attribute.
        """
        return hash(self.LaunchTemplateId)

    @cached_property
    def versions(self) -> List["LaunchTemplateVersion"] | None:
        """
        Return the :py:class:`LaunchTemplateVersion` objects that belong to this
        template, 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.LaunchTemplateId,
                }
            )
        except AttributeError:
            return []
        return LaunchTemplateVersion.objects.using(self.session).list(**pk)  # type: ignore[arg-type]

    @cached_property
    def default_version(self) -> Optional["LaunchTemplateVersion"]:
        """
        Return the :py:class:`LaunchTemplateVersion` object that is the default version
        of this template, 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.LaunchTemplateId,
                    "Version": self.DefaultVersionNumber,
                }
            )
        except AttributeError:
            return None
        return LaunchTemplateVersion.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def latest_version(self) -> Optional["LaunchTemplateVersion"]:
        """
        Return the :py:class:`LaunchTemplateVersion` object that is the latest version
        of this template, 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.LaunchTemplateId,
                    "Version": self.LatestVersionNumber,
                }
            )
        except AttributeError:
            return None
        return LaunchTemplateVersion.objects.using(self.session).get(**pk)  # type: ignore[arg-type]


class LaunchTemplateIamInstanceProfileSpecification(Boto3Model):
    """
    Describes an IAM instance profile.
    """

    Arn: str | None = None
    """
    The Amazon Resource Name (ARN) of the instance profile.
    """
    Name: str | None = None
    """
    The name of the instance profile.
    """


class LaunchTemplateEbsBlockDevice(Boto3Model):
    """
    Describes a block device for an EBS volume.
    """

    Encrypted: bool | None = None
    """
    Indicates whether the EBS volume is encrypted.
    """
    DeleteOnTermination: bool | None = None
    """
    Indicates whether the EBS volume is deleted on instance termination.
    """
    Iops: int | None = None
    """
    The number of I/O operations per second (IOPS) that the volume supports.
    """
    KmsKeyId: str | None = None
    """
    Identifier (key ID, key alias, key ARN, or alias ARN) of the customer managed KMS
    key to use for EBS encryption.
    """
    SnapshotId: str | None = None
    """
    The ID of the snapshot.
    """
    VolumeSize: int | None = None
    """
    The size of the volume, in GiB.
    """
    VolumeType: Literal["standard", "io1", "io2", "gp2", "sc1", "st1", "gp3"] | None = None
    """
    The volume type.
    """
    Throughput: int | None = None
    """
    The throughput that the volume supports, in MiB/s.
    """
    VolumeInitializationRate: int | None = None
    """
    The Amazon EBS Provisioned Rate for Volume Initialization (volume initialization
    rate) specified for the volume, in MiB/s.

    If no volume initialization rate was specified, the value is ``null``.
    """


class LaunchTemplateBlockDeviceMapping(Boto3Model):
    """
    Describes a block device mapping.
    """

    DeviceName: str | None = None
    """
    The device name.
    """
    VirtualName: str | None = None
    """
    The virtual device name (ephemeralN).
    """
    Ebs: LaunchTemplateEbsBlockDevice | None = None
    """
    Information about the block device for an EBS volume.
    """
    NoDevice: str | None = None
    """
    To omit the device from the block device mapping, specify an empty string.
    """


class PrivateIpAddressSpecification(Boto3Model):
    """
    Describes a secondary private IPv4 address for a network interface.
    """

    Primary: bool | None = None
    """
    Indicates whether the private IPv4 address is the primary private IPv4 address.

    Only one IPv4 address can be designated as primary.
    """
    PrivateIpAddress: str | None = None
    """
    The private IPv4 address.
    """


class Ipv4PrefixSpecificationResponse(Boto3Model):
    """
    Information about the IPv4 delegated prefixes assigned to a network interface.
    """

    Ipv4Prefix: str | None = None
    """
    The IPv4 delegated prefixes assigned to the network interface.
    """


class Ipv6PrefixSpecificationResponse(Boto3Model):
    """
    Information about the IPv6 delegated prefixes assigned to a network interface.
    """

    Ipv6Prefix: str | None = None
    """
    The IPv6 delegated prefixes assigned to the network interface.
    """


class LaunchTemplateEnaSrdUdpSpecification(Boto3Model):
    """
    ENA Express is compatible with both TCP and UDP transport protocols.

    When it's enabled, TCP traffic automatically uses it. However, some UDP-based
    applications are designed to handle network packets that are out of order, without a
    need for retransmission, such as live video broadcasting or other near-real-time
    applications. For UDP traffic, you can specify whether to use ENA Express, based on
    your application environment needs.
    """

    EnaSrdUdpEnabled: bool | None = None
    """
    Indicates whether UDP traffic to and from the instance uses ENA Express.

    To specify this setting, you must first enable ENA Express.
    """


class LaunchTemplateEnaSrdSpecification(Boto3Model):
    """
    ENA Express uses Amazon Web Services Scalable Reliable Datagram (SRD) technology to
    increase the maximum bandwidth used per stream and minimize tail latency of network
    traffic between EC2 instances. With ENA Express, you can communicate between two EC2
    instances in the same subnet within the same account, or in different accounts. Both
    sending and receiving instances must have ENA Express enabled.

    To improve the reliability of network packet delivery, ENA Express reorders network
    packets on the receiving end by default. However, some UDP-based applications are
    designed to handle network packets that are out of order to reduce the overhead for
    packet delivery at the network layer. When ENA Express is enabled, you can specify
    whether UDP network traffic uses it.
    """

    EnaSrdEnabled: bool | None = None
    """
    Indicates whether ENA Express is enabled for the network interface.
    """
    EnaSrdUdpSpecification: LaunchTemplateEnaSrdUdpSpecification | None = None
    """
    Configures ENA Express for UDP network traffic.
    """


class EC2ConnectionTrackingSpecification(Boto3Model):
    """
    A security group connection tracking specification that enables you to set the idle
    timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Connection tracking timeouts <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """

    TcpEstablishedTimeout: int | None = None
    """
    Timeout (in seconds) for idle TCP connections in an established state.

    Min: 60 seconds. Max: 432000 seconds (5 days).
    Default: 432000 seconds. Recommended: Less than 432000 seconds.
    """
    UdpTimeout: int | None = None
    """
    Timeout (in seconds) for idle UDP flows that have seen traffic only in a single
    direction or a single request-response transaction.

    Min: 30 seconds. Max: 60 seconds. Default: 30 seconds.
    """
    UdpStreamTimeout: int | None = None
    """
    Timeout (in seconds) for idle UDP flows classified as streams which have seen more
    than one request-response transaction.

    Min: 60 seconds. Max: 180 seconds (3 minutes). Default: 180 seconds.
    """


class LaunchTemplateInstanceNetworkInterfaceSpecification(Boto3Model):
    """
    Describes a network interface.
    """

    AssociateCarrierIpAddress: bool | None = None
    """
    Indicates whether to associate a Carrier IP address with eth0 for a new network
    interface.
    """
    AssociatePublicIpAddress: bool | None = None
    """
    Indicates whether to associate a public IPv4 address with eth0 for a new network
    interface.
    """
    DeleteOnTermination: bool | None = None
    """
    Indicates whether the network interface is deleted when the instance is terminated.
    """
    Description: str | None = None
    """
    A description for the network interface.
    """
    DeviceIndex: int | None = None
    """
    The device index for the network interface attachment.
    """
    Groups: List[str] | None = None
    """
    The IDs of one or more security groups.
    """
    InterfaceType: str | None = None
    """
    The type of network interface.
    """
    Ipv6AddressCount: int | None = None
    """
    The number of IPv6 addresses for the network interface.
    """
    Ipv6Addresses: List["InstanceIpv6Address"] | None = None
    """
    The IPv6 addresses for the network interface.
    """
    NetworkInterfaceId: str | None = None
    """
    The ID of the network interface.
    """
    PrivateIpAddress: str | None = None
    """
    The primary private IPv4 address of the network interface.
    """
    PrivateIpAddresses: List["PrivateIpAddressSpecification"] | None = None
    """
    One or more private IPv4 addresses.
    """
    SecondaryPrivateIpAddressCount: int | None = None
    """
    The number of secondary private IPv4 addresses for the network interface.
    """
    SubnetId: str | None = None
    """
    The ID of the subnet for the network interface.
    """
    NetworkCardIndex: int | None = None
    """
    The index of the network card.
    """
    Ipv4Prefixes: List["Ipv4PrefixSpecificationResponse"] | None = None
    """
    One or more IPv4 prefixes assigned to the network interface.
    """
    Ipv4PrefixCount: int | None = None
    """
    The number of IPv4 prefixes that Amazon Web Services automatically assigned to the
    network interface.
    """
    Ipv6Prefixes: List["Ipv6PrefixSpecificationResponse"] | None = None
    """
    One or more IPv6 prefixes assigned to the network interface.
    """
    Ipv6PrefixCount: int | None = None
    """
    The number of IPv6 prefixes that Amazon Web Services automatically assigned to the
    network interface.
    """
    PrimaryIpv6: bool | None = None
    """
    The primary IPv6 address of the network interface.

    When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be
    made the primary IPv6 address until the instance is terminated or the network
    interface is detached. For more information about primary IPv6 addresses, see
    `RunInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html>`_.
    """
    EnaSrdSpecification: LaunchTemplateEnaSrdSpecification | None = None
    """
    Contains the ENA Express settings for instances launched from your launch template.
    """
    ConnectionTrackingSpecification: EC2ConnectionTrackingSpecification | None = None
    """
    A security group connection tracking specification that enables you to set the
    timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Idle connection tracking timeout <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """
    EnaQueueCount: int | None = None
    """
    The number of ENA queues created with the instance.
    """


class LaunchTemplatesMonitoring(Boto3Model):
    """
    Describes the monitoring for the instance.
    """

    Enabled: bool | None = None
    """
    Indicates whether detailed monitoring is enabled.

    Otherwise, basic monitoring is enabled.
    """


class LaunchTemplatePlacement(Boto3Model):
    """
    Describes the placement of an instance.
    """

    AvailabilityZone: str | None = None
    """
    The Availability Zone of the instance.
    """
    AvailabilityZoneId: str | None = None
    """
    The ID of the Availability Zone of the instance.
    """
    Affinity: str | None = None
    """
    The affinity setting for the instance on the Dedicated Host.
    """
    GroupName: str | None = None
    """
    The name of the placement group for the instance.
    """
    HostId: str | None = None
    """
    The ID of the Dedicated Host for the instance.
    """
    Tenancy: Literal["default", "dedicated", "host"] | None = None
    """
    The tenancy of the instance.

    An instance with a tenancy of ``dedicated`` runs on single-tenant hardware.
    """
    SpreadDomain: str | None = None
    """
    Reserved for future use.
    """
    HostResourceGroupArn: str | None = None
    """
    The ARN of the host resource group in which to launch the instances.
    """
    PartitionNumber: int | None = None
    """
    The number of the partition the instance should launch in.

    Valid only if the placement group strategy is set to
    ``partition``.
    """
    GroupId: str | None = None
    """
    The Group ID of the placement group.

    You must specify the Placement Group **Group ID** to launch an instance in a shared
    placement group.
    """


class LaunchTemplateTagSpecification(TagsDictMixin, Boto3Model):
    """
    The tags specification for the launch template.
    """

    tag_class: ClassVar[Type] = Tag
    ResourceType: Literal["capacity-reservation", "client-vpn-endpoint", "customer-gateway", "carrier-gateway", "coip-pool", "declarative-policies-report", "dedicated-host", "dhcp-options", "egress-only-internet-gateway", "elastic-ip", "elastic-gpu", "export-image-task", "export-instance-task", "fleet", "fpga-image", "host-reservation", "image", "image-usage-report", "import-image-task", "import-snapshot-task", "instance", "instance-event-window", "internet-gateway", "ipam", "ipam-pool", "ipam-scope", "ipv4pool-ec2", "ipv6pool-ec2", "key-pair", "launch-template", "local-gateway", "local-gateway-route-table", "local-gateway-virtual-interface", "local-gateway-virtual-interface-group", "local-gateway-route-table-vpc-association", "local-gateway-route-table-virtual-interface-group-association", "natgateway", "network-acl", "network-interface", "network-insights-analysis", "network-insights-path", "network-insights-access-scope", "network-insights-access-scope-analysis", "outpost-lag", "placement-group", "prefix-list", "replace-root-volume-task", "reserved-instances", "route-table", "security-group", "security-group-rule", "service-link-virtual-interface", "snapshot", "spot-fleet-request", "spot-instances-request", "subnet", "subnet-cidr-reservation", "traffic-mirror-filter", "traffic-mirror-session", "traffic-mirror-target", "transit-gateway", "transit-gateway-attachment", "transit-gateway-connect-peer", "transit-gateway-multicast-domain", "transit-gateway-policy-table", "transit-gateway-route-table", "transit-gateway-route-table-announcement", "volume", "vpc", "vpc-endpoint", "vpc-endpoint-connection", "vpc-endpoint-service", "vpc-endpoint-service-permission", "vpc-peering-connection", "vpn-connection", "vpn-gateway", "vpc-flow-log", "capacity-reservation-fleet", "traffic-mirror-filter-rule", "vpc-endpoint-connection-device-type", "verified-access-instance", "verified-access-group", "verified-access-endpoint", "verified-access-policy", "verified-access-trust-provider", "vpn-connection-device-type", "vpc-block-public-access-exclusion", "route-server", "route-server-endpoint", "route-server-peer", "ipam-resource-discovery", "ipam-resource-discovery-association", "instance-connect-endpoint", "verified-access-endpoint-target", "ipam-external-resource-verification-token", "capacity-block", "mac-modification-task"] | None = None
    """
    The type of resource to tag.
    """
    Tags: List[Tag] | None = None
    """
    The tags for the resource.
    """


class ElasticGpuSpecificationResponse(Boto3Model):
    """
    Deprecated.

    Amazon Elastic Graphics reached end of life on January 8, 2024.
    """

    Type: str | None = None
    """
    Deprecated.
    """


class LaunchTemplateElasticInferenceAcceleratorResponse(Boto3Model):
    """
    Amazon Elastic Inference is no longer available.

    Describes an elastic inference accelerator.
    """

    Type: str | None = None
    """
    The type of elastic inference accelerator.

    The possible values are eia1.medium, eia1.large, and eia1.xlarge.
    """
    Count: int | None = None
    """
    The number of elastic inference accelerators to attach to the instance.
    """


class LaunchTemplateSpotMarketOptions(Boto3Model):
    """
    The options for Spot Instances.
    """

    MaxPrice: str | None = None
    """
    The maximum hourly price you're willing to pay for a Spot Instance.

    We do not recommend using this parameter because it
    can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price. If you
    do specify this parameter, it must be more than USD $0.001. Specifying a value below USD $0.001 will result in an
    ``InvalidParameterValue`` error message when the launch template is used to launch an instance.
    """
    SpotInstanceType: Literal["one-time", "persistent"] | None = None
    """
    The Spot Instance request type.
    """
    BlockDurationMinutes: int | None = None
    """
    The required duration for the Spot Instances (also known as Spot blocks), in
    minutes.

    This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360).
    """
    ValidUntil: datetime | None = None
    """
    The end date of the request.

    For a one-time request, the request remains active until all instances launch, the
    request is canceled, or this date is reached. If the request is persistent, it
    remains active until it is canceled or this date and time is reached.
    """
    InstanceInterruptionBehavior: Literal["hibernate", "stop", "terminate"] | None = None
    """
    The behavior when a Spot Instance is interrupted.
    """


class LaunchTemplateInstanceMarketOptions(Boto3Model):
    """
    The market (purchasing) option for the instances.
    """

    MarketType: Literal["spot", "capacity-block"] | None = None
    """
    The market type.
    """
    SpotOptions: LaunchTemplateSpotMarketOptions | None = None
    """
    The options for Spot Instances.
    """


class InstanceCreditSpecification(Boto3Model):
    """
    Describes the credit option for CPU usage of a T instance.
    """

    CpuCredits: str | None = None
    """
    The credit option for CPU usage of a T instance.
    """


class LaunchTemplateCpuOptions(Boto3Model):
    """
    The CPU options for the instance.
    """

    CoreCount: int | None = None
    """
    The number of CPU cores for the instance.
    """
    ThreadsPerCore: int | None = None
    """
    The number of threads per CPU core.
    """
    AmdSevSnp: Literal["enabled", "disabled"] | None = None
    """
    Indicates whether the instance is enabled for AMD SEV-SNP.

    For more information, see `AMD SEV-SNP for Amazon EC2 instances
    <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sev-snp.html>`_.
    """


class LaunchTemplateCapacityReservationSpecificationResponse(Boto3Model):
    """
    Information about the Capacity Reservation targeting option.
    """

    CapacityReservationPreference: Literal["capacity-reservations-only", "open", "none"] | None = None
    """
    Indicates the instance's Capacity Reservation preferences.

    Possible preferences include:
    """
    CapacityReservationTarget: CapacityReservationTargetResponse | None = None
    """
    Information about the target Capacity Reservation or Capacity Reservation group.
    """


class LaunchTemplateLicenseConfiguration(Boto3Model):
    """
    Describes a license configuration.
    """

    LicenseConfigurationArn: str | None = None
    """
    The Amazon Resource Name (ARN) of the license configuration.
    """


class LaunchTemplateHibernationOptions(Boto3Model):
    """
    Indicates whether an instance is configured for hibernation.
    """

    Configured: bool | None = None
    """
    If this parameter is set to ``true``, the instance is enabled for hibernation;
    otherwise, it is not enabled for hibernation.
    """


class LaunchTemplateInstanceMetadataOptions(Boto3Model):
    """
    The metadata options for the instance.

    For more information, see
    `Use instance metadata to manage your EC2 instance <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html>`_
    in the *Amazon EC2 User
    Guide*.
    """

    State: Literal["pending", "applied"] | None = None
    """
    The state of the metadata option changes.
    """
    HttpTokens: Literal["optional", "required"] | None = None
    """
    Indicates whether IMDSv2 is required.
    """
    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
    """
    Enables or disables the HTTP metadata endpoint on your instances.

    If the parameter is not specified, the default state
    is ``enabled``.
    """
    HttpProtocolIpv6: Literal["disabled", "enabled"] | None = None
    """
    Enables or disables the IPv6 endpoint for the instance metadata service.
    """
    InstanceMetadataTags: Literal["disabled", "enabled"] | None = None
    """
    Set to ``enabled`` to allow access to instance tags from the instance metadata.

    Set to ``disabled`` to turn off access
    to instance tags from the instance metadata. For more information, see `View tags for your EC2 instances using instance
    metadata <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html>`_.
    """


class LaunchTemplateEnclaveOptions(Boto3Model):
    """
    Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.
    """

    Enabled: bool | None = None
    """
    If this parameter is set to ``true``, the instance is enabled for Amazon Web
    Services Nitro Enclaves; otherwise, it is not enabled for Amazon Web Services Nitro
    Enclaves.
    """


class VCpuCountRange(Boto3Model):
    """
    The minimum and maximum number of vCPUs.
    """

    Min: int | None = None
    """
    The minimum number of vCPUs.

    If the value is ``0``, there is no minimum limit.
    """
    Max: int | None = None
    """
    The maximum number of vCPUs.

    If this parameter is not specified, there is no maximum limit.
    """


class InstanceMemoryMiB(Boto3Model):
    """
    The minimum and maximum amount of memory, in MiB.
    """

    Min: int | None = None
    """
    The minimum amount of memory, in MiB.

    If this parameter is not specified, there is no minimum limit.
    """
    Max: int | None = None
    """
    The maximum amount of memory, in MiB.

    If this parameter is not specified, there is no maximum limit.
    """


class InstanceMemoryGiBPerVCpu(Boto3Model):
    """
    The minimum and maximum amount of memory per vCPU, in GiB.
    """

    Min: float | None = None
    """
    The minimum amount of memory per vCPU, in GiB.

    If this parameter is not specified, there is no minimum limit.
    """
    Max: float | None = None
    """
    The maximum amount of memory per vCPU, in GiB.

    If this parameter is not specified, there is no maximum limit.
    """


class InstanceNetworkInterfaceCount(Boto3Model):
    """
    The minimum and maximum number of network interfaces.
    """

    Min: int | None = None
    """
    The minimum number of network interfaces.

    If this parameter is not specified, there is no minimum limit.
    """
    Max: int | None = None
    """
    The maximum number of network interfaces.

    If this parameter is not specified, there is no maximum limit.
    """


class InstanceTotalLocalStorageGB(Boto3Model):
    """
    The minimum and maximum amount of total local storage, in GB.
    """

    Min: float | None = None
    """
    The minimum amount of total local storage, in GB.

    If this parameter is not specified, there is no minimum limit.
    """
    Max: float | None = None
    """
    The maximum amount of total local storage, in GB.

    If this parameter is not specified, there is no maximum limit.
    """


class InstanceBaselineEbsBandwidthMbps(Boto3Model):
    """
    The minimum and maximum baseline bandwidth to Amazon EBS, 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*.
    """

    Min: int | None = None
    """
    The minimum baseline bandwidth, in Mbps.

    If this parameter is not specified, there is no minimum limit.
    """
    Max: int | None = None
    """
    The maximum baseline bandwidth, in Mbps.

    If this parameter is not specified, there is no maximum limit.
    """


class InstanceAcceleratorCount(Boto3Model):
    """
    The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services
    Inferentia chips) on an instance.
    """

    Min: int | None = None
    """
    The minimum number of accelerators.

    If this parameter is not specified, there is no minimum limit.
    """
    Max: int | None = None
    """
    The maximum number of accelerators.

    If this parameter is not specified, there is no maximum limit.
    """


class InstanceAcceleratorTotalMemoryMiB(Boto3Model):
    """
    The minimum and maximum amount of total accelerator memory, in MiB.
    """

    Min: int | None = None
    """
    The minimum amount of accelerator memory, in MiB.

    If this parameter is not specified, there is no minimum limit.
    """
    Max: int | None = None
    """
    The maximum amount of accelerator memory, in MiB.

    If this parameter is not specified, there is no maximum limit.
    """


class InstanceNetworkBandwidthGbps(Boto3Model):
    """
    The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps).

    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 Gbps.

    If this parameter is not specified, there is no minimum limit.
    """
    Max: float | None = None
    """
    The maximum amount of network bandwidth, in Gbps.

    If this parameter is not specified, there is no maximum limit.
    """


class PerformanceFactorReference(Boto3Model):
    """
    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.

    Currently, only one instance family can be specified in the list.
    """

    InstanceFamily: str | None = None
    """
    The instance family to use as a baseline reference.
    """


class CpuPerformanceFactor(Boto3Model):
    """
    The CPU performance to consider, using an instance family as the baseline reference.
    """

    References: List["PerformanceFactorReference"] | None = None
    """
    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.
    """


class EC2BaselinePerformanceFactors(Boto3Model):
    """
    The baseline performance to consider, using an instance family as a baseline
    reference. The instance family establishes the lowest acceptable level of
    performance. Amazon EC2 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`` would use the CPU performance of the ``c6i`` family as the baseline reference.
    """

    Cpu: CpuPerformanceFactor | None = None
    """
    The CPU performance to consider, using an instance family as the baseline reference.
    """


class LaunchTemplateInstanceRequirements(Boto3Model):
    """
    The attributes for the instance types. When you specify instance attributes, Amazon
    EC2 will identify instance types with these attributes.

    You must specify ``VCpuCount`` and ``MemoryMiB``. All other attributes are optional. Any unspecified optional attribute
    is set to its default.

    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 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.

    If you specify ``InstanceRequirements``, you can't specify ``InstanceType``.

    Attribute-based instance type selection is only supported when using Auto Scaling groups, EC2 Fleet, and Spot Fleet to
    launch instances. If you plan to use the launch template in the `launch instance
    wizard <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-instance-wizard.html>`_ or with the `RunInstances
    API <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html>`_, you can't specify
    ``InstanceRequirements``.

    For more information, see `Create 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*, and also `Specify attributes for instance type
    selection for EC2 Fleet or Spot Fleet <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-attribute-based-
    instance-type-selection.html>`_ and `Spot placement score <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-
    placement-score.html>`_ in the *Amazon EC2 User Guide*.
    """

    VCpuCount: VCpuCountRange | None = None
    """
    The minimum and maximum number of vCPUs.
    """
    MemoryMiB: InstanceMemoryMiB | None = None
    """
    The minimum and maximum amount of memory, in MiB.
    """
    CpuManufacturers: List[Literal["intel", "amd", "amazon-web-services", "apple"]] | None = None
    """
    The CPU manufacturers to include.
    """
    MemoryGiBPerVCpu: InstanceMemoryGiBPerVCpu | None = None
    """
    The minimum and maximum amount of memory per vCPU, in GiB.
    """
    ExcludedInstanceTypes: List[str] | None = None
    """
    The instance types to exclude.
    """
    InstanceGenerations: List[Literal["current", "previous"]] | None = None
    """
    Indicates whether current or previous generation instance types are included.

    The current generation instance types are recommended for use. Current generation
    instance types are typically the latest two to three generations in each instance
    family. For more information, see
    `Instance types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html>`_
    in the *Amazon EC2 User Guide*.
    """
    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 Spot 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 Spot price is
    from the lowest priced current generation instance types, and failing that, from the
    lowest priced previous generation instance types that match your attributes. When
    Amazon EC2 selects instance types with your attributes, it will exclude instance
    types whose Spot 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. When Amazon EC2 selects
    instance types with your attributes, it will exclude instance types whose price
    exceeds your specified threshold.
    """
    BareMetal: Literal["included", "required", "excluded"] | None = None
    """
    Indicates whether bare metal instance types must be included, excluded, or required.
    """
    BurstablePerformance: Literal["included", "required", "excluded"] | None = None
    """
    Indicates whether burstable performance T 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>`_.
    """
    RequireHibernateSupport: bool | None = None
    """
    Indicates whether instance types must support hibernation for On-Demand Instances.
    """
    NetworkInterfaceCount: InstanceNetworkInterfaceCount | None = None
    """
    The minimum and maximum number of network interfaces.
    """
    LocalStorage: Literal["included", "required", "excluded"] | None = None
    """
    Indicates whether instance types with instance store volumes are included, excluded,
    or required.

    For more information,
    `Amazon EC2 instance store <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html>`_
    in the *Amazon EC2
    User Guide*.
    """
    LocalStorageTypes: List[Literal["hdd", "ssd"]] | None = None
    """
    The type of local storage that is required.
    """
    TotalLocalStorageGB: InstanceTotalLocalStorageGB | None = None
    """
    The minimum and maximum amount of total local storage, in GB.
    """
    BaselineEbsBandwidthMbps: InstanceBaselineEbsBandwidthMbps | None = None
    """
    The minimum and maximum baseline bandwidth to Amazon EBS, 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: List[Literal["gpu", "fpga", "inference"]] | None = None
    """
    The accelerator types that must be on the instance type.
    """
    AcceleratorCount: InstanceAcceleratorCount | None = None
    """
    The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services
    Inferentia chips) on an instance.
    """
    AcceleratorManufacturers: List[Literal["amazon-web-services", "amd", "nvidia", "xilinx", "habana"]] | None = None
    """
    Indicates whether instance types must have accelerators by specific manufacturers.
    """
    AcceleratorNames: List[Literal["a100", "inferentia", "k520", "k80", "m60", "radeon-pro-v520", "t4", "vu9p", "v100", "a10g", "h100", "t4g"]] | None = None
    """
    The accelerators that must be on the instance type.
    """
    AcceleratorTotalMemoryMiB: InstanceAcceleratorTotalMemoryMiB | None = None
    """
    The minimum and maximum amount of total accelerator memory, in MiB.
    """
    NetworkBandwidthGbps: InstanceNetworkBandwidthGbps | None = None
    """
    The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps).
    """
    AllowedInstanceTypes: List[str] | None = None
    """
    The instance types to apply your specified attributes against.

    All other instance types are ignored, even if they match your specified attributes.
    """
    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 the
    lowest priced current generation instance types, and failing that, from the lowest
    priced previous generation instance types that match your attributes. When Amazon
    EC2 selects instance types with your attributes, it will exclude instance types
    whose price exceeds your specified threshold.
    """
    BaselinePerformanceFactors: EC2BaselinePerformanceFactors | None = None
    """
    The baseline performance to consider, using an instance family as a baseline
    reference.

    The instance family establishes
    the lowest acceptable level of performance. Amazon EC2 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 more information, see `Performance
    protection <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-attribute-based-instance-type-
    selection.html#ec2fleet-abis-performance-protection>`_ in the *Amazon EC2 User Guide*.
    """


class LaunchTemplatePrivateDnsNameOptions(Boto3Model):
    """
    Describes the options for instance hostnames.
    """

    HostnameType: Literal["ip-name", "resource-name"] | None = None
    """
    The type of hostname to assign to an instance.
    """
    EnableResourceNameDnsARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS A
    records.
    """
    EnableResourceNameDnsAAAARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA
    records.
    """


class LaunchTemplateInstanceMaintenanceOptions(Boto3Model):
    """
    The maintenance options of your instance.
    """

    AutoRecovery: Literal["default", "disabled"] | None = None
    """
    Disables the automatic recovery behavior of your instance or sets it to default.
    """


class LaunchTemplateNetworkPerformanceOptions(Boto3Model):
    """
    With network performance options, you can adjust your bandwidth preferences to meet
    the needs of the workload that runs on your instance at launch.
    """

    BandwidthWeighting: Literal["default", "vpc-1", "ebs-1"] | None = None
    """
    When you configure network bandwidth weighting, you can boost baseline bandwidth for
    either networking or EBS by up to 25%.

    The total available baseline bandwidth for your instance remains the same. The
    default option uses the standard bandwidth configuration for your instance type.
    """


class ResponseLaunchTemplateData(Boto3Model):
    """
    The information for a launch template.
    """

    KernelId: str | None = None
    """
    The ID of the kernel, if applicable.
    """
    EbsOptimized: bool | None = None
    """
    Indicates whether the instance is optimized for Amazon EBS I/O.
    """
    IamInstanceProfile: LaunchTemplateIamInstanceProfileSpecification | None = None
    """
    The IAM instance profile.
    """
    BlockDeviceMappings: List["LaunchTemplateBlockDeviceMapping"] | None = None
    """
    The block device mappings.
    """
    NetworkInterfaces: List["LaunchTemplateInstanceNetworkInterfaceSpecification"] | None = None
    """
    The network interfaces.
    """
    ImageId: str | None = None
    """
    The ID of the AMI or a Systems Manager parameter.

    The Systems Manager parameter will resolve to the ID of the AMI at instance launch.
    """
    InstanceType: Literal["a1.medium", "a1.large", "a1.xlarge", "a1.2xlarge", "a1.4xlarge", "a1.metal", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge", "c5.large", "c5.xlarge", "c5.2xlarge", "c5.4xlarge", "c5.9xlarge", "c5.12xlarge", "c5.18xlarge", "c5.24xlarge", "c5.metal", "c5a.large", "c5a.xlarge", "c5a.2xlarge", "c5a.4xlarge", "c5a.8xlarge", "c5a.12xlarge", "c5a.16xlarge", "c5a.24xlarge", "c5ad.large", "c5ad.xlarge", "c5ad.2xlarge", "c5ad.4xlarge", "c5ad.8xlarge", "c5ad.12xlarge", "c5ad.16xlarge", "c5ad.24xlarge", "c5d.large", "c5d.xlarge", "c5d.2xlarge", "c5d.4xlarge", "c5d.9xlarge", "c5d.12xlarge", "c5d.18xlarge", "c5d.24xlarge", "c5d.metal", "c5n.large", "c5n.xlarge", "c5n.2xlarge", "c5n.4xlarge", "c5n.9xlarge", "c5n.18xlarge", "c5n.metal", "c6g.medium", "c6g.large", "c6g.xlarge", "c6g.2xlarge", "c6g.4xlarge", "c6g.8xlarge", "c6g.12xlarge", "c6g.16xlarge", "c6g.metal", "c6gd.medium", "c6gd.large", "c6gd.xlarge", "c6gd.2xlarge", "c6gd.4xlarge", "c6gd.8xlarge", "c6gd.12xlarge", "c6gd.16xlarge", "c6gd.metal", "c6gn.medium", "c6gn.large", "c6gn.xlarge", "c6gn.2xlarge", "c6gn.4xlarge", "c6gn.8xlarge", "c6gn.12xlarge", "c6gn.16xlarge", "c6i.large", "c6i.xlarge", "c6i.2xlarge", "c6i.4xlarge", "c6i.8xlarge", "c6i.12xlarge", "c6i.16xlarge", "c6i.24xlarge", "c6i.32xlarge", "c6i.metal", "cc1.4xlarge", "cc2.8xlarge", "cg1.4xlarge", "cr1.8xlarge", "d2.xlarge", "d2.2xlarge", "d2.4xlarge", "d2.8xlarge", "d3.xlarge", "d3.2xlarge", "d3.4xlarge", "d3.8xlarge", "d3en.xlarge", "d3en.2xlarge", "d3en.4xlarge", "d3en.6xlarge", "d3en.8xlarge", "d3en.12xlarge", "dl1.24xlarge", "f1.2xlarge", "f1.4xlarge", "f1.16xlarge", "g2.2xlarge", "g2.8xlarge", "g3.4xlarge", "g3.8xlarge", "g3.16xlarge", "g3s.xlarge", "g4ad.xlarge", "g4ad.2xlarge", "g4ad.4xlarge", "g4ad.8xlarge", "g4ad.16xlarge", "g4dn.xlarge", "g4dn.2xlarge", "g4dn.4xlarge", "g4dn.8xlarge", "g4dn.12xlarge", "g4dn.16xlarge", "g4dn.metal", "g5.xlarge", "g5.2xlarge", "g5.4xlarge", "g5.8xlarge", "g5.12xlarge", "g5.16xlarge", "g5.24xlarge", "g5.48xlarge", "g5g.xlarge", "g5g.2xlarge", "g5g.4xlarge", "g5g.8xlarge", "g5g.16xlarge", "g5g.metal", "hi1.4xlarge", "hpc6a.48xlarge", "hs1.8xlarge", "h1.2xlarge", "h1.4xlarge", "h1.8xlarge", "h1.16xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "i3.large", "i3.xlarge", "i3.2xlarge", "i3.4xlarge", "i3.8xlarge", "i3.16xlarge", "i3.metal", "i3en.large", "i3en.xlarge", "i3en.2xlarge", "i3en.3xlarge", "i3en.6xlarge", "i3en.12xlarge", "i3en.24xlarge", "i3en.metal", "im4gn.large", "im4gn.xlarge", "im4gn.2xlarge", "im4gn.4xlarge", "im4gn.8xlarge", "im4gn.16xlarge", "inf1.xlarge", "inf1.2xlarge", "inf1.6xlarge", "inf1.24xlarge", "is4gen.medium", "is4gen.large", "is4gen.xlarge", "is4gen.2xlarge", "is4gen.4xlarge", "is4gen.8xlarge", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "m4.large", "m4.xlarge", "m4.2xlarge", "m4.4xlarge", "m4.10xlarge", "m4.16xlarge", "m5.large", "m5.xlarge", "m5.2xlarge", "m5.4xlarge", "m5.8xlarge", "m5.12xlarge", "m5.16xlarge", "m5.24xlarge", "m5.metal", "m5a.large", "m5a.xlarge", "m5a.2xlarge", "m5a.4xlarge", "m5a.8xlarge", "m5a.12xlarge", "m5a.16xlarge", "m5a.24xlarge", "m5ad.large", "m5ad.xlarge", "m5ad.2xlarge", "m5ad.4xlarge", "m5ad.8xlarge", "m5ad.12xlarge", "m5ad.16xlarge", "m5ad.24xlarge", "m5d.large", "m5d.xlarge", "m5d.2xlarge", "m5d.4xlarge", "m5d.8xlarge", "m5d.12xlarge", "m5d.16xlarge", "m5d.24xlarge", "m5d.metal", "m5dn.large", "m5dn.xlarge", "m5dn.2xlarge", "m5dn.4xlarge", "m5dn.8xlarge", "m5dn.12xlarge", "m5dn.16xlarge", "m5dn.24xlarge", "m5dn.metal", "m5n.large", "m5n.xlarge", "m5n.2xlarge", "m5n.4xlarge", "m5n.8xlarge", "m5n.12xlarge", "m5n.16xlarge", "m5n.24xlarge", "m5n.metal", "m5zn.large", "m5zn.xlarge", "m5zn.2xlarge", "m5zn.3xlarge", "m5zn.6xlarge", "m5zn.12xlarge", "m5zn.metal", "m6a.large", "m6a.xlarge", "m6a.2xlarge", "m6a.4xlarge", "m6a.8xlarge", "m6a.12xlarge", "m6a.16xlarge", "m6a.24xlarge", "m6a.32xlarge", "m6a.48xlarge", "m6g.metal", "m6g.medium", "m6g.large", "m6g.xlarge", "m6g.2xlarge", "m6g.4xlarge", "m6g.8xlarge", "m6g.12xlarge", "m6g.16xlarge", "m6gd.metal", "m6gd.medium", "m6gd.large", "m6gd.xlarge", "m6gd.2xlarge", "m6gd.4xlarge", "m6gd.8xlarge", "m6gd.12xlarge", "m6gd.16xlarge", "m6i.large", "m6i.xlarge", "m6i.2xlarge", "m6i.4xlarge", "m6i.8xlarge", "m6i.12xlarge", "m6i.16xlarge", "m6i.24xlarge", "m6i.32xlarge", "m6i.metal", "mac1.metal", "p2.xlarge", "p2.8xlarge", "p2.16xlarge", "p3.2xlarge", "p3.8xlarge", "p3.16xlarge", "p3dn.24xlarge", "p4d.24xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "r4.large", "r4.xlarge", "r4.2xlarge", "r4.4xlarge", "r4.8xlarge", "r4.16xlarge", "r5.large", "r5.xlarge", "r5.2xlarge", "r5.4xlarge", "r5.8xlarge", "r5.12xlarge", "r5.16xlarge", "r5.24xlarge", "r5.metal", "r5a.large", "r5a.xlarge", "r5a.2xlarge", "r5a.4xlarge", "r5a.8xlarge", "r5a.12xlarge", "r5a.16xlarge", "r5a.24xlarge", "r5ad.large", "r5ad.xlarge", "r5ad.2xlarge", "r5ad.4xlarge", "r5ad.8xlarge", "r5ad.12xlarge", "r5ad.16xlarge", "r5ad.24xlarge", "r5b.large", "r5b.xlarge", "r5b.2xlarge", "r5b.4xlarge", "r5b.8xlarge", "r5b.12xlarge", "r5b.16xlarge", "r5b.24xlarge", "r5b.metal", "r5d.large", "r5d.xlarge", "r5d.2xlarge", "r5d.4xlarge", "r5d.8xlarge", "r5d.12xlarge", "r5d.16xlarge", "r5d.24xlarge", "r5d.metal", "r5dn.large", "r5dn.xlarge", "r5dn.2xlarge", "r5dn.4xlarge", "r5dn.8xlarge", "r5dn.12xlarge", "r5dn.16xlarge", "r5dn.24xlarge", "r5dn.metal", "r5n.large", "r5n.xlarge", "r5n.2xlarge", "r5n.4xlarge", "r5n.8xlarge", "r5n.12xlarge", "r5n.16xlarge", "r5n.24xlarge", "r5n.metal", "r6g.medium", "r6g.large", "r6g.xlarge", "r6g.2xlarge", "r6g.4xlarge", "r6g.8xlarge", "r6g.12xlarge", "r6g.16xlarge", "r6g.metal", "r6gd.medium", "r6gd.large", "r6gd.xlarge", "r6gd.2xlarge", "r6gd.4xlarge", "r6gd.8xlarge", "r6gd.12xlarge", "r6gd.16xlarge", "r6gd.metal", "r6i.large", "r6i.xlarge", "r6i.2xlarge", "r6i.4xlarge", "r6i.8xlarge", "r6i.12xlarge", "r6i.16xlarge", "r6i.24xlarge", "r6i.32xlarge", "r6i.metal", "t1.micro", "t2.nano", "t2.micro", "t2.small", "t2.medium", "t2.large", "t2.xlarge", "t2.2xlarge", "t3.nano", "t3.micro", "t3.small", "t3.medium", "t3.large", "t3.xlarge", "t3.2xlarge", "t3a.nano", "t3a.micro", "t3a.small", "t3a.medium", "t3a.large", "t3a.xlarge", "t3a.2xlarge", "t4g.nano", "t4g.micro", "t4g.small", "t4g.medium", "t4g.large", "t4g.xlarge", "t4g.2xlarge", "u-6tb1.56xlarge", "u-6tb1.112xlarge", "u-9tb1.112xlarge", "u-12tb1.112xlarge", "u-6tb1.metal", "u-9tb1.metal", "u-12tb1.metal", "u-18tb1.metal", "u-24tb1.metal", "vt1.3xlarge", "vt1.6xlarge", "vt1.24xlarge", "x1.16xlarge", "x1.32xlarge", "x1e.xlarge", "x1e.2xlarge", "x1e.4xlarge", "x1e.8xlarge", "x1e.16xlarge", "x1e.32xlarge", "x2iezn.2xlarge", "x2iezn.4xlarge", "x2iezn.6xlarge", "x2iezn.8xlarge", "x2iezn.12xlarge", "x2iezn.metal", "x2gd.medium", "x2gd.large", "x2gd.xlarge", "x2gd.2xlarge", "x2gd.4xlarge", "x2gd.8xlarge", "x2gd.12xlarge", "x2gd.16xlarge", "x2gd.metal", "z1d.large", "z1d.xlarge", "z1d.2xlarge", "z1d.3xlarge", "z1d.6xlarge", "z1d.12xlarge", "z1d.metal", "x2idn.16xlarge", "x2idn.24xlarge", "x2idn.32xlarge", "x2iedn.xlarge", "x2iedn.2xlarge", "x2iedn.4xlarge", "x2iedn.8xlarge", "x2iedn.16xlarge", "x2iedn.24xlarge", "x2iedn.32xlarge", "c6a.large", "c6a.xlarge", "c6a.2xlarge", "c6a.4xlarge", "c6a.8xlarge", "c6a.12xlarge", "c6a.16xlarge", "c6a.24xlarge", "c6a.32xlarge", "c6a.48xlarge", "c6a.metal", "m6a.metal", "i4i.large", "i4i.xlarge", "i4i.2xlarge", "i4i.4xlarge", "i4i.8xlarge", "i4i.16xlarge", "i4i.32xlarge", "i4i.metal", "x2idn.metal", "x2iedn.metal", "c7g.medium", "c7g.large", "c7g.xlarge", "c7g.2xlarge", "c7g.4xlarge", "c7g.8xlarge", "c7g.12xlarge", "c7g.16xlarge", "mac2.metal", "c6id.large", "c6id.xlarge", "c6id.2xlarge", "c6id.4xlarge", "c6id.8xlarge", "c6id.12xlarge", "c6id.16xlarge", "c6id.24xlarge", "c6id.32xlarge", "c6id.metal", "m6id.large", "m6id.xlarge", "m6id.2xlarge", "m6id.4xlarge", "m6id.8xlarge", "m6id.12xlarge", "m6id.16xlarge", "m6id.24xlarge", "m6id.32xlarge", "m6id.metal", "r6id.large", "r6id.xlarge", "r6id.2xlarge", "r6id.4xlarge", "r6id.8xlarge", "r6id.12xlarge", "r6id.16xlarge", "r6id.24xlarge", "r6id.32xlarge", "r6id.metal", "r6a.large", "r6a.xlarge", "r6a.2xlarge", "r6a.4xlarge", "r6a.8xlarge", "r6a.12xlarge", "r6a.16xlarge", "r6a.24xlarge", "r6a.32xlarge", "r6a.48xlarge", "r6a.metal", "p4de.24xlarge", "u-3tb1.56xlarge", "u-18tb1.112xlarge", "u-24tb1.112xlarge", "trn1.2xlarge", "trn1.32xlarge", "hpc6id.32xlarge", "c6in.large", "c6in.xlarge", "c6in.2xlarge", "c6in.4xlarge", "c6in.8xlarge", "c6in.12xlarge", "c6in.16xlarge", "c6in.24xlarge", "c6in.32xlarge", "m6in.large", "m6in.xlarge", "m6in.2xlarge", "m6in.4xlarge", "m6in.8xlarge", "m6in.12xlarge", "m6in.16xlarge", "m6in.24xlarge", "m6in.32xlarge", "m6idn.large", "m6idn.xlarge", "m6idn.2xlarge", "m6idn.4xlarge", "m6idn.8xlarge", "m6idn.12xlarge", "m6idn.16xlarge", "m6idn.24xlarge", "m6idn.32xlarge", "r6in.large", "r6in.xlarge", "r6in.2xlarge", "r6in.4xlarge", "r6in.8xlarge", "r6in.12xlarge", "r6in.16xlarge", "r6in.24xlarge", "r6in.32xlarge", "r6idn.large", "r6idn.xlarge", "r6idn.2xlarge", "r6idn.4xlarge", "r6idn.8xlarge", "r6idn.12xlarge", "r6idn.16xlarge", "r6idn.24xlarge", "r6idn.32xlarge", "c7g.metal", "m7g.medium", "m7g.large", "m7g.xlarge", "m7g.2xlarge", "m7g.4xlarge", "m7g.8xlarge", "m7g.12xlarge", "m7g.16xlarge", "m7g.metal", "r7g.medium", "r7g.large", "r7g.xlarge", "r7g.2xlarge", "r7g.4xlarge", "r7g.8xlarge", "r7g.12xlarge", "r7g.16xlarge", "r7g.metal", "c6in.metal", "m6in.metal", "m6idn.metal", "r6in.metal", "r6idn.metal", "inf2.xlarge", "inf2.8xlarge", "inf2.24xlarge", "inf2.48xlarge", "trn1n.32xlarge", "i4g.large", "i4g.xlarge", "i4g.2xlarge", "i4g.4xlarge", "i4g.8xlarge", "i4g.16xlarge", "hpc7g.4xlarge", "hpc7g.8xlarge", "hpc7g.16xlarge", "c7gn.medium", "c7gn.large", "c7gn.xlarge", "c7gn.2xlarge", "c7gn.4xlarge", "c7gn.8xlarge", "c7gn.12xlarge", "c7gn.16xlarge", "p5.48xlarge", "m7i.large", "m7i.xlarge", "m7i.2xlarge", "m7i.4xlarge", "m7i.8xlarge", "m7i.12xlarge", "m7i.16xlarge", "m7i.24xlarge", "m7i.48xlarge", "m7i-flex.large", "m7i-flex.xlarge", "m7i-flex.2xlarge", "m7i-flex.4xlarge", "m7i-flex.8xlarge", "m7a.medium", "m7a.large", "m7a.xlarge", "m7a.2xlarge", "m7a.4xlarge", "m7a.8xlarge", "m7a.12xlarge", "m7a.16xlarge", "m7a.24xlarge", "m7a.32xlarge", "m7a.48xlarge", "m7a.metal-48xl", "hpc7a.12xlarge", "hpc7a.24xlarge", "hpc7a.48xlarge", "hpc7a.96xlarge", "c7gd.medium", "c7gd.large", "c7gd.xlarge", "c7gd.2xlarge", "c7gd.4xlarge", "c7gd.8xlarge", "c7gd.12xlarge", "c7gd.16xlarge", "m7gd.medium", "m7gd.large", "m7gd.xlarge", "m7gd.2xlarge", "m7gd.4xlarge", "m7gd.8xlarge", "m7gd.12xlarge", "m7gd.16xlarge", "r7gd.medium", "r7gd.large", "r7gd.xlarge", "r7gd.2xlarge", "r7gd.4xlarge", "r7gd.8xlarge", "r7gd.12xlarge", "r7gd.16xlarge", "r7a.medium", "r7a.large", "r7a.xlarge", "r7a.2xlarge", "r7a.4xlarge", "r7a.8xlarge", "r7a.12xlarge", "r7a.16xlarge", "r7a.24xlarge", "r7a.32xlarge", "r7a.48xlarge", "c7i.large", "c7i.xlarge", "c7i.2xlarge", "c7i.4xlarge", "c7i.8xlarge", "c7i.12xlarge", "c7i.16xlarge", "c7i.24xlarge", "c7i.48xlarge", "mac2-m2pro.metal", "r7iz.large", "r7iz.xlarge", "r7iz.2xlarge", "r7iz.4xlarge", "r7iz.8xlarge", "r7iz.12xlarge", "r7iz.16xlarge", "r7iz.32xlarge", "c7a.medium", "c7a.large", "c7a.xlarge", "c7a.2xlarge", "c7a.4xlarge", "c7a.8xlarge", "c7a.12xlarge", "c7a.16xlarge", "c7a.24xlarge", "c7a.32xlarge", "c7a.48xlarge", "c7a.metal-48xl", "r7a.metal-48xl", "r7i.large", "r7i.xlarge", "r7i.2xlarge", "r7i.4xlarge", "r7i.8xlarge", "r7i.12xlarge", "r7i.16xlarge", "r7i.24xlarge", "r7i.48xlarge", "dl2q.24xlarge", "mac2-m2.metal", "i4i.12xlarge", "i4i.24xlarge", "c7i.metal-24xl", "c7i.metal-48xl", "m7i.metal-24xl", "m7i.metal-48xl", "r7i.metal-24xl", "r7i.metal-48xl", "r7iz.metal-16xl", "r7iz.metal-32xl", "c7gd.metal", "m7gd.metal", "r7gd.metal", "g6.xlarge", "g6.2xlarge", "g6.4xlarge", "g6.8xlarge", "g6.12xlarge", "g6.16xlarge", "g6.24xlarge", "g6.48xlarge", "gr6.4xlarge", "gr6.8xlarge", "c7i-flex.large", "c7i-flex.xlarge", "c7i-flex.2xlarge", "c7i-flex.4xlarge", "c7i-flex.8xlarge", "u7i-12tb.224xlarge", "u7in-16tb.224xlarge", "u7in-24tb.224xlarge", "u7in-32tb.224xlarge", "u7ib-12tb.224xlarge", "c7gn.metal", "r8g.medium", "r8g.large", "r8g.xlarge", "r8g.2xlarge", "r8g.4xlarge", "r8g.8xlarge", "r8g.12xlarge", "r8g.16xlarge", "r8g.24xlarge", "r8g.48xlarge", "r8g.metal-24xl", "r8g.metal-48xl", "mac2-m1ultra.metal", "g6e.xlarge", "g6e.2xlarge", "g6e.4xlarge", "g6e.8xlarge", "g6e.12xlarge", "g6e.16xlarge", "g6e.24xlarge", "g6e.48xlarge", "c8g.medium", "c8g.large", "c8g.xlarge", "c8g.2xlarge", "c8g.4xlarge", "c8g.8xlarge", "c8g.12xlarge", "c8g.16xlarge", "c8g.24xlarge", "c8g.48xlarge", "c8g.metal-24xl", "c8g.metal-48xl", "m8g.medium", "m8g.large", "m8g.xlarge", "m8g.2xlarge", "m8g.4xlarge", "m8g.8xlarge", "m8g.12xlarge", "m8g.16xlarge", "m8g.24xlarge", "m8g.48xlarge", "m8g.metal-24xl", "m8g.metal-48xl", "x8g.medium", "x8g.large", "x8g.xlarge", "x8g.2xlarge", "x8g.4xlarge", "x8g.8xlarge", "x8g.12xlarge", "x8g.16xlarge", "x8g.24xlarge", "x8g.48xlarge", "x8g.metal-24xl", "x8g.metal-48xl", "i7ie.large", "i7ie.xlarge", "i7ie.2xlarge", "i7ie.3xlarge", "i7ie.6xlarge", "i7ie.12xlarge", "i7ie.18xlarge", "i7ie.24xlarge", "i7ie.48xlarge", "i8g.large", "i8g.xlarge", "i8g.2xlarge", "i8g.4xlarge", "i8g.8xlarge", "i8g.12xlarge", "i8g.16xlarge", "i8g.24xlarge", "i8g.metal-24xl", "u7i-6tb.112xlarge", "u7i-8tb.112xlarge", "u7inh-32tb.480xlarge", "p5e.48xlarge", "p5en.48xlarge", "f2.12xlarge", "f2.48xlarge", "trn2.48xlarge", "c7i-flex.12xlarge", "c7i-flex.16xlarge", "m7i-flex.12xlarge", "m7i-flex.16xlarge", "i7ie.metal-24xl", "i7ie.metal-48xl", "i8g.48xlarge", "c8gd.medium", "c8gd.large", "c8gd.xlarge", "c8gd.2xlarge", "c8gd.4xlarge", "c8gd.8xlarge", "c8gd.12xlarge", "c8gd.16xlarge", "c8gd.24xlarge", "c8gd.48xlarge", "c8gd.metal-24xl", "c8gd.metal-48xl", "i7i.large", "i7i.xlarge", "i7i.2xlarge", "i7i.4xlarge", "i7i.8xlarge", "i7i.12xlarge", "i7i.16xlarge", "i7i.24xlarge", "i7i.48xlarge", "i7i.metal-24xl", "i7i.metal-48xl", "p6-b200.48xlarge", "m8gd.medium", "m8gd.large", "m8gd.xlarge", "m8gd.2xlarge", "m8gd.4xlarge", "m8gd.8xlarge", "m8gd.12xlarge", "m8gd.16xlarge", "m8gd.24xlarge", "m8gd.48xlarge", "m8gd.metal-24xl", "m8gd.metal-48xl", "r8gd.medium", "r8gd.large", "r8gd.xlarge", "r8gd.2xlarge", "r8gd.4xlarge", "r8gd.8xlarge", "r8gd.12xlarge", "r8gd.16xlarge", "r8gd.24xlarge", "r8gd.48xlarge", "r8gd.metal-24xl", "r8gd.metal-48xl", "c8gn.medium", "c8gn.large", "c8gn.xlarge", "c8gn.2xlarge", "c8gn.4xlarge", "c8gn.8xlarge", "c8gn.12xlarge", "c8gn.16xlarge", "c8gn.24xlarge", "c8gn.48xlarge", "c8gn.metal-24xl", "c8gn.metal-48xl", "f2.6xlarge", "p6e-gb200.36xlarge", "g6f.large", "g6f.xlarge", "g6f.2xlarge", "g6f.4xlarge", "gr6f.4xlarge", "p5.4xlarge", "r8i.large", "r8i.xlarge", "r8i.2xlarge", "r8i.4xlarge", "r8i.8xlarge", "r8i.12xlarge", "r8i.16xlarge", "r8i.24xlarge", "r8i.32xlarge", "r8i.48xlarge", "r8i.96xlarge", "r8i.metal-48xl", "r8i.metal-96xl", "r8i-flex.large", "r8i-flex.xlarge", "r8i-flex.2xlarge", "r8i-flex.4xlarge", "r8i-flex.8xlarge", "r8i-flex.12xlarge", "r8i-flex.16xlarge", "m8i.large", "m8i.xlarge", "m8i.2xlarge", "m8i.4xlarge", "m8i.8xlarge", "m8i.12xlarge", "m8i.16xlarge", "m8i.24xlarge", "m8i.32xlarge", "m8i.48xlarge", "m8i.96xlarge", "m8i.metal-48xl", "m8i.metal-96xl", "m8i-flex.large", "m8i-flex.xlarge", "m8i-flex.2xlarge", "m8i-flex.4xlarge", "m8i-flex.8xlarge", "m8i-flex.12xlarge", "m8i-flex.16xlarge", "i8ge.large", "i8ge.xlarge", "i8ge.2xlarge", "i8ge.3xlarge", "i8ge.6xlarge", "i8ge.12xlarge", "i8ge.18xlarge", "i8ge.24xlarge", "i8ge.48xlarge", "i8ge.metal-24xl", "i8ge.metal-48xl", "mac-m4.metal", "mac-m4pro.metal", "r8gn.medium", "r8gn.large", "r8gn.xlarge", "r8gn.2xlarge", "r8gn.4xlarge", "r8gn.8xlarge", "r8gn.12xlarge", "r8gn.16xlarge", "r8gn.24xlarge", "r8gn.48xlarge", "r8gn.metal-24xl", "r8gn.metal-48xl"] | None = None
    """
    The instance type.
    """
    KeyName: str | None = None
    """
    The name of the key pair.
    """
    Monitoring: LaunchTemplatesMonitoring | None = None
    """
    The monitoring for the instance.
    """
    Placement: LaunchTemplatePlacement | None = None
    """
    The placement of the instance.
    """
    RamDiskId: str | None = None
    """
    The ID of the RAM disk, if applicable.
    """
    DisableApiTermination: bool | None = None
    """
    If set to ``true``, indicates that the instance cannot be terminated using the
    Amazon EC2 console, command line tool, or API.
    """
    InstanceInitiatedShutdownBehavior: Literal["stop", "terminate"] | None = None
    """
    Indicates whether an instance stops or terminates when you initiate shutdown from
    the instance (using the operating system command for system shutdown).
    """
    UserData: str | None = None
    """
    The user data for the instance.
    """
    TagSpecifications: List["LaunchTemplateTagSpecification"] | None = None
    """
    The tags that are applied to the resources that are created during instance launch.
    """
    ElasticGpuSpecifications: List["ElasticGpuSpecificationResponse"] | None = None
    """
    Deprecated.
    """
    ElasticInferenceAccelerators: List["LaunchTemplateElasticInferenceAcceleratorResponse"] | None = None
    """
    Amazon Elastic Inference is no longer available.
    """
    SecurityGroupIds: List[str] | None = None
    """
    The security group IDs.
    """
    SecurityGroups: List[str] | None = None
    """
    The security group names.
    """
    InstanceMarketOptions: LaunchTemplateInstanceMarketOptions | None = None
    """
    The market (purchasing) option for the instances.
    """
    CreditSpecification: InstanceCreditSpecification | None = None
    """
    The credit option for CPU usage of the instance.
    """
    CpuOptions: LaunchTemplateCpuOptions | None = None
    """
    The CPU options for the instance.

    For more information, see
    `CPU options for Amazon EC2 instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html>`_
    in the *Amazon EC2 User
    Guide*.
    """
    CapacityReservationSpecification: LaunchTemplateCapacityReservationSpecificationResponse | None = None
    """
    Information about the Capacity Reservation targeting option.
    """
    LicenseSpecifications: List["LaunchTemplateLicenseConfiguration"] | None = None
    """
    The license configurations.
    """
    HibernationOptions: LaunchTemplateHibernationOptions | None = None
    """
    Indicates whether an instance is configured for hibernation.

    For more information, see
    `Hibernate your Amazon EC2 instance <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html>`_
    in the *Amazon EC2 User Guide*.
    """
    MetadataOptions: LaunchTemplateInstanceMetadataOptions | None = None
    """
    The metadata options for the instance.

    For more information, see
    `Configure the Instance Metadata Service options <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html>`_
    in the *Amazon
    EC2 User Guide*.
    """
    EnclaveOptions: LaunchTemplateEnclaveOptions | None = None
    """
    Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.
    """
    InstanceRequirements: LaunchTemplateInstanceRequirements | None = None
    """
    The attributes for the instance types.

    When you specify instance attributes, Amazon EC2 will identify instance types with
    these attributes.
    """
    PrivateDnsNameOptions: LaunchTemplatePrivateDnsNameOptions | None = None
    """
    The options for the instance hostname.
    """
    MaintenanceOptions: LaunchTemplateInstanceMaintenanceOptions | None = None
    """
    The maintenance options for your instance.
    """
    DisableApiStop: bool | None = None
    """
    Indicates whether the instance is enabled for stop protection.

    For more information, see
    `Enable stop protection for your EC2 instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-stop-protection.html>`_
    in the *Amazon EC2
    User Guide*.
    """
    Operator: OperatorResponse | None = None
    """
    The entity that manages the launch template.
    """
    NetworkPerformanceOptions: LaunchTemplateNetworkPerformanceOptions | None = None
    """
    Contains the launch template settings for network performance options for your
    instance.
    """


class LaunchTemplateVersion(PrimaryBoto3Model):
    """
    Describes a launch template version.
    """

    manager_class: ClassVar[Type[Boto3ModelManager]] = LaunchTemplateVersionManager

    LaunchTemplateId: str | None = None
    """
    The ID of the launch template.
    """
    LaunchTemplateName: str | None = None
    """
    The name of the launch template.
    """
    VersionNumber: int = Field(default=None, frozen=True)
    """
    The version number.
    """
    VersionDescription: str | None = None
    """
    The description for the version.
    """
    CreateTime: datetime = Field(default=None, frozen=True)
    """
    The time the version was created.
    """
    CreatedBy: str = Field(default=None, frozen=True)
    """
    The principal that created the version.
    """
    DefaultVersion: bool = Field(default=None, frozen=True)
    """
    Indicates whether the version is the default version.
    """
    LaunchTemplateData: ResponseLaunchTemplateData | None = None
    """
    Information about the launch template.
    """
    Operator: OperatorResponse = Field(default=None, frozen=True)
    """
    The entity that manages the launch template.
    """

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the
        :py:attr:`LaunchTemplateName` attribute.

        Returns:
            The name of the model instance.
        """
        return self.LaunchTemplateName

    @property
    def pk(self) -> OrderedDict[str, Any]:
        return OrderedDict(
            {
                "LaunchTemplateId": self.LaunchTemplateId,
                "Version": self.VersionNumber,
            }
        )

    @cached_property
    def ami(self) -> Optional["AMI"]:
        """
        Return the py:class:`AMI` object that this version 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(
                {
                    "ImageId": self.LaunchTemplateData.ImageId,
                }
            )
        except AttributeError:
            return None
        return AMI.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def instance_type(self) -> Optional["EC2InstanceType"]:
        """
        Return the :py:class:`EC2InstanceType` object that this version 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(
                {
                    "InstanceType": self.LaunchTemplateData.InstanceType,
                }
            )
        except AttributeError:
            return None
        return EC2InstanceType.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def launch_template(self) -> Optional["LaunchTemplate"]:
        """
        Return the :py:class:`LaunchTemplate` object that this version belongs to, 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.LaunchTemplateId,
                }
            )
        except AttributeError:
            return None
        return LaunchTemplate.objects.using(self.session).get(**pk)  # type: ignore[arg-type]


class NetworkInterfaceAssociation(Boto3Model):
    """
    Describes association information for an Elastic IP address (IPv4 only), or a
    Carrier IP address (for a network interface which resides in a subnet in a
    Wavelength Zone).
    """

    AllocationId: str | None = None
    """
    The allocation ID.
    """
    AssociationId: str | None = None
    """
    The association ID.
    """
    IpOwnerId: str | None = None
    """
    The ID of the Elastic IP address owner.
    """
    PublicDnsName: str | None = None
    """
    The public DNS name.
    """
    PublicIp: str | None = None
    """
    The address of the Elastic IP address bound to the network interface.
    """
    CustomerOwnedIp: str | None = None
    """
    The customer-owned IP address associated with the network interface.
    """
    CarrierIp: str | None = None
    """
    The carrier IP address associated with the network interface.
    """


class AttachmentEnaSrdUdpSpecification(Boto3Model):
    """
    ENA Express is compatible with both TCP and UDP transport protocols.

    When it's enabled, TCP traffic automatically uses it. However, some UDP-based
    applications are designed to handle network packets that are out of order, without a
    need for retransmission, such as live video broadcasting or other near-real-time
    applications. For UDP traffic, you can specify whether to use ENA Express, based on
    your application environment needs.
    """

    EnaSrdUdpEnabled: bool | None = None
    """
    Indicates whether UDP traffic to and from the instance uses ENA Express.

    To specify this setting, you must first enable ENA Express.
    """


class AttachmentEnaSrdSpecification(Boto3Model):
    """
    ENA Express uses Amazon Web Services Scalable Reliable Datagram (SRD) technology to
    increase the maximum bandwidth used per stream and minimize tail latency of network
    traffic between EC2 instances. With ENA Express, you can communicate between two EC2
    instances in the same subnet within the same account, or in different accounts. Both
    sending and receiving instances must have ENA Express enabled.

    To improve the reliability of network packet delivery, ENA Express reorders network
    packets on the receiving end by default. However, some UDP-based applications are
    designed to handle network packets that are out of order to reduce the overhead for
    packet delivery at the network layer. When ENA Express is enabled, you can specify
    whether UDP network traffic uses it.
    """

    EnaSrdEnabled: bool | None = None
    """
    Indicates whether ENA Express is enabled for the network interface.
    """
    EnaSrdUdpSpecification: AttachmentEnaSrdUdpSpecification | None = None
    """
    Configures ENA Express for UDP network traffic.
    """


class NetworkInterfaceAttachment(Boto3Model):
    """
    Describes a network interface attachment.
    """

    AttachTime: datetime | None = None
    """
    The timestamp indicating when the attachment initiated.
    """
    AttachmentId: str | None = None
    """
    The ID of the network interface attachment.
    """
    DeleteOnTermination: bool | None = None
    """
    Indicates whether the network interface is deleted when the instance is terminated.
    """
    DeviceIndex: int | None = None
    """
    The device index of the network interface attachment on the instance.
    """
    NetworkCardIndex: int | None = None
    """
    The index of the network card.
    """
    InstanceId: str | None = None
    """
    The ID of the instance.
    """
    InstanceOwnerId: str | None = None
    """
    The Amazon Web Services account ID of the owner of the instance.
    """
    Status: Literal["attaching", "attached", "detaching", "detached"] | None = None
    """
    The attachment state.
    """
    EnaSrdSpecification: AttachmentEnaSrdSpecification | None = None
    """
    Configures ENA Express for the network interface that this action attaches to the
    instance.
    """
    EnaQueueCount: int | None = None
    """
    The number of ENA queues created with the instance.
    """


class EC2ConnectionTrackingConfiguration(Boto3Model):
    """
    A security group connection tracking configuration that enables you to set the idle
    timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Connection tracking timeouts <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """

    TcpEstablishedTimeout: int | None = None
    """
    Timeout (in seconds) for idle TCP connections in an established state.

    Min: 60 seconds. Max: 432000 seconds (5 days).
    Default: 432000 seconds. Recommended: Less than 432000 seconds.
    """
    UdpStreamTimeout: int | None = None
    """
    Timeout (in seconds) for idle UDP flows classified as streams which have seen more
    than one request-response transaction.

    Min: 60 seconds. Max: 180 seconds (3 minutes). Default: 180 seconds.
    """
    UdpTimeout: int | None = None
    """
    Timeout (in seconds) for idle UDP flows that have seen traffic only in a single
    direction or a single request-response transaction.

    Min: 30 seconds. Max: 60 seconds. Default: 30 seconds.
    """


class NetworkInterfaceIpv6Address(Boto3Model):
    """
    Describes an IPv6 address associated with a network interface.
    """

    Ipv6Address: str | None = None
    """
    The IPv6 address.
    """
    PublicIpv6DnsName: str | None = None
    """
    An IPv6-enabled public hostname for a network interface.

    Requests from within the VPC or from the internet resolve to
    the IPv6 GUA of the network interface. For more information, see `EC2 instance hostnames, DNS names, and
    domains <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-naming.html>`_ in the *Amazon EC2 User Guide*.
    """
    IsPrimaryIpv6: bool | None = None
    """
    Determines if an IPv6 address associated with a network interface is the primary
    IPv6 address.

    When you enable an IPv6
    GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is
    terminated or the network interface is detached. For more information, see `ModifyNetworkInterfaceAttribute <https://doc
    s.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyNetworkInterfaceAttribute.html>`_.
    """


class EC2PublicIpDnsNameOptions(Boto3Model):
    """
    Public hostname type options.

    For more information, see `EC2 instance hostnames, DNS names, and
    domains <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-naming.html>`_ in the *Amazon EC2 User Guide*.
    """

    DnsHostnameType: str | None = None
    """
    The public hostname type.

    For more information, see `EC2 instance hostnames, DNS names, and
    domains <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-naming.html>`_ in the *Amazon EC2 User Guide*.
    """
    PublicIpv4DnsName: str | None = None
    """
    An IPv4-enabled public hostname for a network interface.

    Requests from within the VPC resolve to the private primary IPv4 address of the
    network interface. Requests from the internet resolve to the public IPv4 address of
    the network interface.
    """
    PublicIpv6DnsName: str | None = None
    """
    An IPv6-enabled public hostname for a network interface.

    Requests from within the VPC or from the internet resolve to the IPv6 GUA of the
    network interface.
    """
    PublicDualStackDnsName: str | None = None
    """
    A dual-stack public hostname for a network interface.

    Requests from within the VPC resolve to both the private IPv4 address and the IPv6
    Global Unicast Address of the network interface. Requests from the internet resolve
    to both the public IPv4 and the IPv6 GUA address of the network interface.
    """


class NetworkInterfacePrivateIpAddress(Boto3Model):
    """
    Describes the private IPv4 address of a network interface.
    """

    Association: NetworkInterfaceAssociation | None = None
    """
    The association information for an Elastic IP address (IPv4) associated with the
    network interface.
    """
    Primary: bool | None = None
    """
    Indicates whether this IPv4 address is the primary private IPv4 address of the
    network interface.
    """
    PrivateDnsName: str | None = None
    """
    The private DNS name.
    """
    PrivateIpAddress: str | None = None
    """
    The private IPv4 address.
    """


class Ipv4PrefixSpecification(Boto3Model):
    """
    Describes an IPv4 prefix.
    """

    Ipv4Prefix: str | None = None
    """
    The IPv4 prefix.

    For information, see
    `Assigning prefixes to network interfaces <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-eni.html>`_
    in the *Amazon EC2 User Guide*.
    """


class Ipv6PrefixSpecification(Boto3Model):
    """
    Describes the IPv6 prefix.
    """

    Ipv6Prefix: str | None = None
    """
    The IPv6 prefix.
    """


class EC2EnaSrdUdpSpecification(Boto3Model):
    """
    ENA Express is compatible with both TCP and UDP transport protocols.

    When it's enabled, TCP traffic automatically uses it. However, some UDP-based
    applications are designed to handle network packets that are out of order, without a
    need for retransmission, such as live video broadcasting or other near-real-time
    applications. For UDP traffic, you can specify whether to use ENA Express, based on
    your application environment needs.
    """

    EnaSrdUdpEnabled: bool | None = None
    """
    Indicates whether UDP traffic to and from the instance uses ENA Express.

    To specify this setting, you must first enable ENA Express.
    """


class EnaSrdSpecification(Boto3Model):
    """
    ENA Express uses Amazon Web Services Scalable Reliable Datagram (SRD) technology to
    increase the maximum bandwidth used per stream and minimize tail latency of network
    traffic between EC2 instances. With ENA Express, you can communicate between two EC2
    instances in the same subnet within the same account, or in different accounts. Both
    sending and receiving instances must have ENA Express enabled.

    To improve the reliability of network packet delivery, ENA Express reorders network
    packets on the receiving end by default. However, some UDP-based applications are
    designed to handle network packets that are out of order to reduce the overhead for
    packet delivery at the network layer. When ENA Express is enabled, you can specify
    whether UDP network traffic uses it.
    """

    EnaSrdEnabled: bool | None = None
    """
    Indicates whether ENA Express is enabled for the network interface.
    """
    EnaSrdUdpSpecification: EC2EnaSrdUdpSpecification | None = None
    """
    Configures ENA Express for UDP network traffic.
    """


class NetworkInterface(PrimaryBoto3Model):
    """
    Describes a network interface.
    """

    manager_class: ClassVar[Type[Boto3ModelManager]] = NetworkInterfaceManager

    InterfaceType: str | None = None
    """
    The type of network interface.
    """
    Association: NetworkInterfaceAssociation = Field(default=None, frozen=True)
    """
    The association information for an Elastic IP address (IPv4) associated with the
    network interface.
    """
    Attachment: NetworkInterfaceAttachment = Field(default=None, frozen=True)
    """
    The network interface attachment.
    """
    AvailabilityZone: str = Field(default=None, frozen=True)
    """
    The Availability Zone.
    """
    ConnectionTrackingConfiguration: EC2ConnectionTrackingConfiguration = Field(
        default=None, frozen=True
    )
    """
    A security group connection tracking configuration that enables you to set the
    timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Connection tracking timeouts <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """
    Description: str | None = None
    """
    A description.
    """
    Groups: List["GroupIdentifier"] | None = None
    """
    Any security groups for the network interface.
    """
    Ipv6Addresses: List["NetworkInterfaceIpv6Address"] | None = None
    """
    The IPv6 addresses associated with the network interface.
    """
    MacAddress: str = Field(default=None, frozen=True)
    """
    The MAC address.
    """
    NetworkInterfaceId: str = Field(default=None, frozen=True)
    """
    The ID of the network interface.
    """
    OutpostArn: str = Field(default=None, frozen=True)
    """
    The Amazon Resource Name (ARN) of the Outpost.
    """
    OwnerId: str = Field(default=None, frozen=True)
    """
    The Amazon Web Services account ID of the owner of the network interface.
    """
    PrivateDnsName: str = Field(default=None, frozen=True)
    """
    The private hostname.

    For more information, see `EC2 instance hostnames, DNS names, and
    domains <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-naming.html>`_ in the *Amazon EC2 User Guide*.
    """
    PublicDnsName: str = Field(default=None, frozen=True)
    """
    A public hostname.

    For more information, see `EC2 instance hostnames, DNS names, and
    domains <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-naming.html>`_ in the *Amazon EC2 User Guide*.
    """
    PublicIpDnsNameOptions: EC2PublicIpDnsNameOptions = Field(default=None, frozen=True)
    """
    Public hostname type options.

    For more information, see `EC2 instance hostnames, DNS names, and
    domains <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-naming.html>`_ in the *Amazon EC2 User Guide*.
    """
    PrivateIpAddress: str | None = None
    """
    The IPv4 address of the network interface within the subnet.
    """
    PrivateIpAddresses: List["NetworkInterfacePrivateIpAddress"] | None = None
    """
    The private IPv4 addresses associated with the network interface.
    """
    Ipv4Prefixes: List["Ipv4PrefixSpecification"] | None = None
    """
    The IPv4 prefixes that are assigned to the network interface.
    """
    Ipv6Prefixes: List["Ipv6PrefixSpecification"] | None = None
    """
    The IPv6 prefixes that are assigned to the network interface.
    """
    RequesterId: str = Field(default=None, frozen=True)
    """
    The alias or Amazon Web Services account ID of the principal or service that created
    the network interface.
    """
    RequesterManaged: bool = Field(default=None, frozen=True)
    """
    Indicates whether the network interface is being managed by Amazon Web Services.
    """
    SourceDestCheck: bool = Field(default=None, frozen=True)
    """
    Indicates whether source/destination checking is enabled.
    """
    Status: Literal["available", "associated", "attaching", "in-use", "detaching"] = (
        Field(default=None, frozen=True)
    )
    """
    The status of the network interface.
    """
    SubnetId: str | None = None
    """
    The ID of the subnet.
    """
    TagSet: List[Tag] = Field(default_factory=list, frozen=True)
    """
    Any tags assigned to the network interface.
    """
    VpcId: str = Field(default=None, frozen=True)
    """
    The ID of the VPC.
    """
    DenyAllIgwTraffic: bool = Field(default=None, frozen=True)
    """
    Indicates whether a network interface with an IPv6 address is unreachable from the
    public internet.

    If the value is
    ``true``, inbound traffic from the internet is dropped and you cannot assign an elastic IP address to the network
    interface. The network interface is reachable from peered VPCs and resources connected through a transit gateway,
    including on-premises networks.
    """
    Ipv6Native: bool = Field(default=None, frozen=True)
    """
    Indicates whether this is an IPv6 only network interface.
    """
    Ipv6Address: str = Field(default=None, frozen=True)
    """
    The IPv6 globally unique address associated with the network interface.
    """
    Operator: OperatorResponse | None = None
    """
    The service provider that manages the network interface.
    """
    AssociatedSubnets: List[str] = Field(default_factory=list, frozen=True)
    """
    The subnets associated with this network interface.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`NetworkInterfaceId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.NetworkInterfaceId

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`NetworkInterfaceId` attribute.
        """
        return hash(self.NetworkInterfaceId)

    @cached_property
    def subnet(self) -> Optional["Subnet"]:
        """
        Return the :py:class:`Subnet` object that this network interface belongs to, 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(
                {
                    "SubnetId": self.SubnetId,
                }
            )
        except AttributeError:
            return None
        return Subnet.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def security_groups(self) -> List["SecurityGroup"] | None:
        """
        Return the :py:class:`SecurityGroup` objects that this network interface belongs
        to, 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(
                {
                    "GroupIds": [
                        identifier.GroupId
                        for identifier in cast("List[GroupIdentifier]", self.Groups)
                    ],
                }
            )
        except AttributeError:
            return []
        return SecurityGroup.objects.using(self.session).list(**pk)  # type: ignore[arg-type]

    def reset(
        self, DryRun: bool = False, SourceDestCheck: str | None = None
    ) -> "None":
        """
        Reset the network interface.

        Keyword Args:
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
            SourceDestCheck: The source/destination checking attribute. Resets the value to ``true``.
        """

        return (
            cast("NetworkInterfaceManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .reset(
                self.NetworkInterfaceId, DryRun=DryRun, SourceDestCheck=SourceDestCheck
            )
        )

    def attach(
        self,
        InstanceId: str,
        DeviceIndex: int,
        NetworkCardIndex: int | None = None,
        EnaSrdSpecification: Optional["EnaSrdSpecification"] = None,
        DryRun: bool = False,
    ) -> "AttachNetworkInterfaceResult":
        """
        Attach the network interface.

        Args:
            InstanceId: The ID of the instance.
            DeviceIndex: The index of the device for the network interface attachment.

        Keyword Args:
            NetworkCardIndex: The index of the network card. Some instance types support multiple network cards. The primary
                network interface must be assigned to network card index 0. The default is network card index 0.
            EnaSrdSpecification: Configures ENA Express for the network interface that this action attaches to the instance.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """

        return (
            cast("NetworkInterfaceManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .attach(
                self.NetworkInterfaceId,
                InstanceId,
                DeviceIndex,
                NetworkCardIndex=NetworkCardIndex,
                EnaSrdSpecification=EnaSrdSpecification,
                DryRun=DryRun,
            )
        )

    def detach(self, Force: bool = False, DryRun: bool = False) -> "None":
        """
        Detach the network interface.

        Keyword Args:
            Force: Specifies whether to force a detachment.
            DryRun: Checks whether you have the required permissions for the action, without actually making the request, and
                provides an error response. If you have the required permissions, the error response is ``DryRunOperation``.
                Otherwise, it is ``UnauthorizedOperation``.
        """

        return (
            cast("NetworkInterfaceManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .detach(self.Attachment.AttachmentId, Force=Force, DryRun=DryRun)
        )


class EC2ProcessorInfo(Boto3Model):
    """
    Describes the processor used by the instance type.
    """

    SupportedArchitectures: List[Literal["i386", "x86_64", "arm64", "x86_64_mac", "arm64_mac"]] | None = None
    """
    The architectures supported by the instance type.
    """
    SustainedClockSpeedInGhz: float | None = None
    """
    The speed of the processor, in GHz.
    """
    SupportedFeatures: List[Literal["amd-sev-snp"]] | None = None
    """
    Indicates whether the instance type supports AMD SEV-SNP.

    If the request returns ``amd-sev-snp``, AMD SEV-SNP is
    supported. Otherwise, it is not supported. For more information, see  `AMD SEV-
    SNP <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sev-snp.html>`_.
    """
    Manufacturer: str | None = None
    """
    The manufacturer of the processor.
    """


class EC2VCpuInfo(Boto3Model):
    """
    Describes the vCPU configurations for the instance type.
    """

    DefaultVCpus: int | None = None
    """
    The default number of vCPUs for the instance type.
    """
    DefaultCores: int | None = None
    """
    The default number of cores for the instance type.
    """
    DefaultThreadsPerCore: int | None = None
    """
    The default number of threads per core for the instance type.
    """
    ValidCores: List[int] | None = None
    """
    The valid number of cores that can be configured for the instance type.
    """
    ValidThreadsPerCore: List[int] | None = None
    """
    The valid number of threads per core that can be configured for the instance type.
    """


class EC2MemoryInfo(Boto3Model):
    """
    Describes the memory for the instance type.
    """

    SizeInMiB: int | None = None
    """
    The size of the memory, in MiB.
    """


class DiskInfo(Boto3Model):
    """
    Describes a disk.
    """

    SizeInGB: int | None = None
    """
    The size of the disk in GB.
    """
    Count: int | None = None
    """
    The number of disks with this configuration.
    """
    Type: Literal["hdd", "ssd"] | None = None
    """
    The type of disk.
    """


class EC2InstanceStorageInfo(Boto3Model):
    """
    Describes the instance store features that are supported by the instance type.
    """

    TotalSizeInGB: int | None = None
    """
    The total size of the disks, in GB.
    """
    Disks: List["DiskInfo"] | None = None
    """
    Describes the disks that are available for the instance type.
    """
    NvmeSupport: Literal["unsupported", "supported", "required"] | None = None
    """
    Indicates whether non-volatile memory express (NVMe) is supported.
    """
    EncryptionSupport: Literal["unsupported", "required"] | None = None
    """
    Indicates whether data is encrypted at rest.
    """


class EC2EbsOptimizedInfo(Boto3Model):
    """
    Describes the optimized EBS performance for supported instance types.
    """

    BaselineBandwidthInMbps: int | None = None
    """
    The baseline bandwidth performance for an EBS-optimized instance type, in Mbps.
    """
    BaselineThroughputInMBps: float | None = None
    """
    The baseline throughput performance for an EBS-optimized instance type, in MB/s.
    """
    BaselineIops: int | None = None
    """
    The baseline input/output storage operations per seconds for an EBS-optimized
    instance type.
    """
    MaximumBandwidthInMbps: int | None = None
    """
    The maximum bandwidth performance for an EBS-optimized instance type, in Mbps.
    """
    MaximumThroughputInMBps: float | None = None
    """
    The maximum throughput performance for an EBS-optimized instance type, in MB/s.
    """
    MaximumIops: int | None = None
    """
    The maximum input/output storage operations per second for an EBS-optimized instance
    type.
    """


class EC2EbsInfo(Boto3Model):
    """
    Describes the Amazon EBS features supported by the instance type.
    """

    EbsOptimizedSupport: Literal["unsupported", "supported", "default"] | None = None
    """
    Indicates whether the instance type is Amazon EBS-optimized.

    For more information, see `Amazon EBS-optimized
    instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html>`_ in *Amazon EC2 User Guide*.
    """
    EncryptionSupport: Literal["unsupported", "supported"] | None = None
    """
    Indicates whether Amazon EBS encryption is supported.
    """
    EbsOptimizedInfo: EC2EbsOptimizedInfo | None = None
    """
    Describes the optimized EBS performance for the instance type.
    """
    NvmeSupport: Literal["unsupported", "supported", "required"] | None = None
    """
    Indicates whether non-volatile memory express (NVMe) is supported.
    """
    MaximumEbsAttachments: int | None = None
    """
    Indicates the maximum number of Amazon EBS volumes that can be attached to the
    instance type.

    For more information, see
    `Amazon EBS volume limits for Amazon EC2 instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html>`_
    in the *Amazon EC2 User Guide*.
    """
    AttachmentLimitType: Literal["shared", "dedicated"] | None = None
    """
    Indicates whether the instance type features a shared or dedicated Amazon EBS volume
    attachment limit.

    For more information, see
    `Amazon EBS volume limits for Amazon EC2 instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html>`_
    in the *Amazon EC2 User Guide*.
    """


class NetworkCardInfo(Boto3Model):
    """
    Describes the network card support of the instance type.
    """

    NetworkCardIndex: int | None = None
    """
    The index of the network card.
    """
    NetworkPerformance: str | None = None
    """
    The network performance of the network card.
    """
    MaximumNetworkInterfaces: int | None = None
    """
    The maximum number of network interfaces for the network card.
    """
    BaselineBandwidthInGbps: float | None = None
    """
    The baseline network performance of the network card, in Gbps.
    """
    PeakBandwidthInGbps: float | None = None
    """
    The peak (burst) network performance of the network card, in Gbps.
    """
    DefaultEnaQueueCountPerInterface: int | None = None
    """
    The default number of the ENA queues for each interface.
    """
    MaximumEnaQueueCount: int | None = None
    """
    The maximum number of the ENA queues.
    """
    MaximumEnaQueueCountPerInterface: int | None = None
    """
    The maximum number of the ENA queues for each interface.
    """


class EC2EfaInfo(Boto3Model):
    """
    Describes the Elastic Fabric Adapters for the instance type.
    """

    MaximumEfaInterfaces: int | None = None
    """
    The maximum number of Elastic Fabric Adapters for the instance type.
    """


class EC2NetworkInfo(Boto3Model):
    """
    Describes the networking features of the instance type.
    """

    NetworkPerformance: str | None = None
    """
    The network performance.
    """
    MaximumNetworkInterfaces: int | None = None
    """
    The maximum number of network interfaces for the instance type.
    """
    MaximumNetworkCards: int | None = None
    """
    The maximum number of physical network cards that can be allocated to the instance.
    """
    DefaultNetworkCardIndex: int | None = None
    """
    The index of the default network card, starting at 0.
    """
    NetworkCards: List["NetworkCardInfo"] | None = None
    """
    Describes the network cards for the instance type.
    """
    Ipv4AddressesPerInterface: int | None = None
    """
    The maximum number of IPv4 addresses per network interface.
    """
    Ipv6AddressesPerInterface: int | None = None
    """
    The maximum number of IPv6 addresses per network interface.
    """
    Ipv6Supported: bool | None = None
    """
    Indicates whether IPv6 is supported.
    """
    EnaSupport: Literal["unsupported", "supported", "required"] | None = None
    """
    Indicates whether Elastic Network Adapter (ENA) is supported.
    """
    EfaSupported: bool | None = None
    """
    Indicates whether Elastic Fabric Adapter (EFA) is supported.
    """
    EfaInfo: EC2EfaInfo | None = None
    """
    Describes the Elastic Fabric Adapters for the instance type.
    """
    EncryptionInTransitSupported: bool | None = None
    """
    Indicates whether the instance type automatically encrypts in-transit traffic
    between instances.
    """
    EnaSrdSupported: bool | None = None
    """
    Indicates whether the instance type supports ENA Express.

    ENA Express uses Amazon Web Services Scalable Reliable Datagram (SRD) technology to
    increase the maximum bandwidth used per stream and minimize tail latency of network
    traffic between EC2 instances.
    """
    BandwidthWeightings: List[Literal["default", "vpc-1", "ebs-1"]] | None = None
    """
    A list of valid settings for configurable bandwidth weighting for the instance type,
    if supported.
    """
    FlexibleEnaQueuesSupport: Literal["unsupported", "supported"] | None = None
    """
    Indicates whether changing the number of ENA queues is supported.
    """


class GpuDeviceMemoryInfo(Boto3Model):
    """
    Describes the memory available to the GPU accelerator.
    """

    SizeInMiB: int | None = None
    """
    The size of the memory available to the GPU accelerator, in MiB.
    """


class GpuDeviceInfo(Boto3Model):
    """
    Describes the GPU accelerators for the instance type.
    """

    Name: str | None = None
    """
    The name of the GPU accelerator.
    """
    Manufacturer: str | None = None
    """
    The manufacturer of the GPU accelerator.
    """
    Count: int | None = None
    """
    The number of GPUs for the instance type.
    """
    MemoryInfo: GpuDeviceMemoryInfo | None = None
    """
    Describes the memory available to the GPU accelerator.
    """


class EC2GpuInfo(Boto3Model):
    """
    Describes the GPU accelerators for the instance type.
    """

    Gpus: List["GpuDeviceInfo"] | None = None
    """
    Describes the GPU accelerators for the instance type.
    """
    TotalGpuMemoryInMiB: int | None = None
    """
    The total size of the memory for the GPU accelerators for the instance type, in MiB.
    """


class FpgaDeviceMemoryInfo(Boto3Model):
    """
    Describes the memory for the FPGA accelerator for the instance type.
    """

    SizeInMiB: int | None = None
    """
    The size of the memory available to the FPGA accelerator, in MiB.
    """


class FpgaDeviceInfo(Boto3Model):
    """
    Describes the FPGA accelerator for the instance type.
    """

    Name: str | None = None
    """
    The name of the FPGA accelerator.
    """
    Manufacturer: str | None = None
    """
    The manufacturer of the FPGA accelerator.
    """
    Count: int | None = None
    """
    The count of FPGA accelerators for the instance type.
    """
    MemoryInfo: FpgaDeviceMemoryInfo | None = None
    """
    Describes the memory for the FPGA accelerator for the instance type.
    """


class EC2FpgaInfo(Boto3Model):
    """
    Describes the FPGAs for the instance type.
    """

    Fpgas: List["FpgaDeviceInfo"] | None = None
    """
    Describes the FPGAs for the instance type.
    """
    TotalFpgaMemoryInMiB: int | None = None
    """
    The total memory of all FPGA accelerators for the instance type.
    """


class EC2PlacementGroupInfo(Boto3Model):
    """
    Describes the placement group support of the instance type.
    """

    SupportedStrategies: List[Literal["cluster", "partition", "spread"]] | None = (
        None
    )
    """
    The supported placement group types.
    """


class InferenceDeviceMemoryInfo(Boto3Model):
    """
    Amazon Elastic Inference is no longer available.

    Describes the memory available to the inference accelerator.
    """

    SizeInMiB: int | None = None
    """
    The size of the memory available to the inference accelerator, in MiB.
    """


class InferenceDeviceInfo(Boto3Model):
    """
    Amazon Elastic Inference is no longer available.

    Describes the Inference accelerators for the instance type.
    """

    Count: int | None = None
    """
    The number of Inference accelerators for the instance type.
    """
    Name: str | None = None
    """
    The name of the Inference accelerator.
    """
    Manufacturer: str | None = None
    """
    The manufacturer of the Inference accelerator.
    """
    MemoryInfo: InferenceDeviceMemoryInfo | None = None
    """
    Describes the memory available to the inference accelerator.
    """


class EC2InferenceAcceleratorInfo(Boto3Model):
    """
    Amazon Elastic Inference is no longer available.

    Describes the Inference accelerators for the instance type.
    """

    Accelerators: List["InferenceDeviceInfo"] | None = None
    """
    Describes the Inference accelerators for the instance type.
    """
    TotalInferenceMemoryInMiB: int | None = None
    """
    The total size of the memory for the inference accelerators for the instance type,
    in MiB.
    """


class EC2NitroTpmInfo(Boto3Model):
    """
    Describes the supported NitroTPM versions for the instance type.
    """

    SupportedVersions: List[str] | None = None
    """
    Indicates the supported NitroTPM versions.
    """


class MediaDeviceMemoryInfo(Boto3Model):
    """
    Describes the memory available to the media accelerator.
    """

    SizeInMiB: int | None = None
    """
    The size of the memory available to each media accelerator, in MiB.
    """


class MediaDeviceInfo(Boto3Model):
    """
    Describes the media accelerators for the instance type.
    """

    Count: int | None = None
    """
    The number of media accelerators for the instance type.
    """
    Name: str | None = None
    """
    The name of the media accelerator.
    """
    Manufacturer: str | None = None
    """
    The manufacturer of the media accelerator.
    """
    MemoryInfo: MediaDeviceMemoryInfo | None = None
    """
    Describes the memory available to the media accelerator.
    """


class EC2MediaAcceleratorInfo(Boto3Model):
    """
    Describes the media accelerators for the instance type.
    """

    Accelerators: List["MediaDeviceInfo"] | None = None
    """
    Describes the media accelerators for the instance type.
    """
    TotalMediaMemoryInMiB: int | None = None
    """
    The total size of the memory for the media accelerators for the instance type, in
    MiB.
    """


class NeuronDeviceCoreInfo(Boto3Model):
    """
    Describes the cores available to the neuron accelerator.
    """

    Count: int | None = None
    """
    The number of cores available to the neuron accelerator.
    """
    Version: int | None = None
    """
    The version of the neuron accelerator.
    """


class NeuronDeviceMemoryInfo(Boto3Model):
    """
    Describes the memory available to the neuron accelerator.
    """

    SizeInMiB: int | None = None
    """
    The size of the memory available to the neuron accelerator, in MiB.
    """


class NeuronDeviceInfo(Boto3Model):
    """
    Describes the neuron accelerators for the instance type.
    """

    Count: int | None = None
    """
    The number of neuron accelerators for the instance type.
    """
    Name: str | None = None
    """
    The name of the neuron accelerator.
    """
    CoreInfo: NeuronDeviceCoreInfo | None = None
    """
    Describes the cores available to each neuron accelerator.
    """
    MemoryInfo: NeuronDeviceMemoryInfo | None = None
    """
    Describes the memory available to each neuron accelerator.
    """


class EC2NeuronInfo(Boto3Model):
    """
    Describes the neuron accelerators for the instance type.
    """

    NeuronDevices: List["NeuronDeviceInfo"] | None = None
    """
    Describes the neuron accelerators for the instance type.
    """
    TotalNeuronDeviceMemoryInMiB: int | None = None
    """
    The total size of the memory for the neuron accelerators for the instance type, in
    MiB.
    """


class EC2InstanceType(ReadonlyPrimaryBoto3Model):
    """
    Describes the instance type.
    """

    manager_class: ClassVar[Type[Boto3ModelManager]] = EC2InstanceTypeManager

    InstanceType: Literal["a1.medium", "a1.large", "a1.xlarge", "a1.2xlarge", "a1.4xlarge", "a1.metal", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge", "c5.large", "c5.xlarge", "c5.2xlarge", "c5.4xlarge", "c5.9xlarge", "c5.12xlarge", "c5.18xlarge", "c5.24xlarge", "c5.metal", "c5a.large", "c5a.xlarge", "c5a.2xlarge", "c5a.4xlarge", "c5a.8xlarge", "c5a.12xlarge", "c5a.16xlarge", "c5a.24xlarge", "c5ad.large", "c5ad.xlarge", "c5ad.2xlarge", "c5ad.4xlarge", "c5ad.8xlarge", "c5ad.12xlarge", "c5ad.16xlarge", "c5ad.24xlarge", "c5d.large", "c5d.xlarge", "c5d.2xlarge", "c5d.4xlarge", "c5d.9xlarge", "c5d.12xlarge", "c5d.18xlarge", "c5d.24xlarge", "c5d.metal", "c5n.large", "c5n.xlarge", "c5n.2xlarge", "c5n.4xlarge", "c5n.9xlarge", "c5n.18xlarge", "c5n.metal", "c6g.medium", "c6g.large", "c6g.xlarge", "c6g.2xlarge", "c6g.4xlarge", "c6g.8xlarge", "c6g.12xlarge", "c6g.16xlarge", "c6g.metal", "c6gd.medium", "c6gd.large", "c6gd.xlarge", "c6gd.2xlarge", "c6gd.4xlarge", "c6gd.8xlarge", "c6gd.12xlarge", "c6gd.16xlarge", "c6gd.metal", "c6gn.medium", "c6gn.large", "c6gn.xlarge", "c6gn.2xlarge", "c6gn.4xlarge", "c6gn.8xlarge", "c6gn.12xlarge", "c6gn.16xlarge", "c6i.large", "c6i.xlarge", "c6i.2xlarge", "c6i.4xlarge", "c6i.8xlarge", "c6i.12xlarge", "c6i.16xlarge", "c6i.24xlarge", "c6i.32xlarge", "c6i.metal", "cc1.4xlarge", "cc2.8xlarge", "cg1.4xlarge", "cr1.8xlarge", "d2.xlarge", "d2.2xlarge", "d2.4xlarge", "d2.8xlarge", "d3.xlarge", "d3.2xlarge", "d3.4xlarge", "d3.8xlarge", "d3en.xlarge", "d3en.2xlarge", "d3en.4xlarge", "d3en.6xlarge", "d3en.8xlarge", "d3en.12xlarge", "dl1.24xlarge", "f1.2xlarge", "f1.4xlarge", "f1.16xlarge", "g2.2xlarge", "g2.8xlarge", "g3.4xlarge", "g3.8xlarge", "g3.16xlarge", "g3s.xlarge", "g4ad.xlarge", "g4ad.2xlarge", "g4ad.4xlarge", "g4ad.8xlarge", "g4ad.16xlarge", "g4dn.xlarge", "g4dn.2xlarge", "g4dn.4xlarge", "g4dn.8xlarge", "g4dn.12xlarge", "g4dn.16xlarge", "g4dn.metal", "g5.xlarge", "g5.2xlarge", "g5.4xlarge", "g5.8xlarge", "g5.12xlarge", "g5.16xlarge", "g5.24xlarge", "g5.48xlarge", "g5g.xlarge", "g5g.2xlarge", "g5g.4xlarge", "g5g.8xlarge", "g5g.16xlarge", "g5g.metal", "hi1.4xlarge", "hpc6a.48xlarge", "hs1.8xlarge", "h1.2xlarge", "h1.4xlarge", "h1.8xlarge", "h1.16xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "i3.large", "i3.xlarge", "i3.2xlarge", "i3.4xlarge", "i3.8xlarge", "i3.16xlarge", "i3.metal", "i3en.large", "i3en.xlarge", "i3en.2xlarge", "i3en.3xlarge", "i3en.6xlarge", "i3en.12xlarge", "i3en.24xlarge", "i3en.metal", "im4gn.large", "im4gn.xlarge", "im4gn.2xlarge", "im4gn.4xlarge", "im4gn.8xlarge", "im4gn.16xlarge", "inf1.xlarge", "inf1.2xlarge", "inf1.6xlarge", "inf1.24xlarge", "is4gen.medium", "is4gen.large", "is4gen.xlarge", "is4gen.2xlarge", "is4gen.4xlarge", "is4gen.8xlarge", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "m4.large", "m4.xlarge", "m4.2xlarge", "m4.4xlarge", "m4.10xlarge", "m4.16xlarge", "m5.large", "m5.xlarge", "m5.2xlarge", "m5.4xlarge", "m5.8xlarge", "m5.12xlarge", "m5.16xlarge", "m5.24xlarge", "m5.metal", "m5a.large", "m5a.xlarge", "m5a.2xlarge", "m5a.4xlarge", "m5a.8xlarge", "m5a.12xlarge", "m5a.16xlarge", "m5a.24xlarge", "m5ad.large", "m5ad.xlarge", "m5ad.2xlarge", "m5ad.4xlarge", "m5ad.8xlarge", "m5ad.12xlarge", "m5ad.16xlarge", "m5ad.24xlarge", "m5d.large", "m5d.xlarge", "m5d.2xlarge", "m5d.4xlarge", "m5d.8xlarge", "m5d.12xlarge", "m5d.16xlarge", "m5d.24xlarge", "m5d.metal", "m5dn.large", "m5dn.xlarge", "m5dn.2xlarge", "m5dn.4xlarge", "m5dn.8xlarge", "m5dn.12xlarge", "m5dn.16xlarge", "m5dn.24xlarge", "m5dn.metal", "m5n.large", "m5n.xlarge", "m5n.2xlarge", "m5n.4xlarge", "m5n.8xlarge", "m5n.12xlarge", "m5n.16xlarge", "m5n.24xlarge", "m5n.metal", "m5zn.large", "m5zn.xlarge", "m5zn.2xlarge", "m5zn.3xlarge", "m5zn.6xlarge", "m5zn.12xlarge", "m5zn.metal", "m6a.large", "m6a.xlarge", "m6a.2xlarge", "m6a.4xlarge", "m6a.8xlarge", "m6a.12xlarge", "m6a.16xlarge", "m6a.24xlarge", "m6a.32xlarge", "m6a.48xlarge", "m6g.metal", "m6g.medium", "m6g.large", "m6g.xlarge", "m6g.2xlarge", "m6g.4xlarge", "m6g.8xlarge", "m6g.12xlarge", "m6g.16xlarge", "m6gd.metal", "m6gd.medium", "m6gd.large", "m6gd.xlarge", "m6gd.2xlarge", "m6gd.4xlarge", "m6gd.8xlarge", "m6gd.12xlarge", "m6gd.16xlarge", "m6i.large", "m6i.xlarge", "m6i.2xlarge", "m6i.4xlarge", "m6i.8xlarge", "m6i.12xlarge", "m6i.16xlarge", "m6i.24xlarge", "m6i.32xlarge", "m6i.metal", "mac1.metal", "p2.xlarge", "p2.8xlarge", "p2.16xlarge", "p3.2xlarge", "p3.8xlarge", "p3.16xlarge", "p3dn.24xlarge", "p4d.24xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "r4.large", "r4.xlarge", "r4.2xlarge", "r4.4xlarge", "r4.8xlarge", "r4.16xlarge", "r5.large", "r5.xlarge", "r5.2xlarge", "r5.4xlarge", "r5.8xlarge", "r5.12xlarge", "r5.16xlarge", "r5.24xlarge", "r5.metal", "r5a.large", "r5a.xlarge", "r5a.2xlarge", "r5a.4xlarge", "r5a.8xlarge", "r5a.12xlarge", "r5a.16xlarge", "r5a.24xlarge", "r5ad.large", "r5ad.xlarge", "r5ad.2xlarge", "r5ad.4xlarge", "r5ad.8xlarge", "r5ad.12xlarge", "r5ad.16xlarge", "r5ad.24xlarge", "r5b.large", "r5b.xlarge", "r5b.2xlarge", "r5b.4xlarge", "r5b.8xlarge", "r5b.12xlarge", "r5b.16xlarge", "r5b.24xlarge", "r5b.metal", "r5d.large", "r5d.xlarge", "r5d.2xlarge", "r5d.4xlarge", "r5d.8xlarge", "r5d.12xlarge", "r5d.16xlarge", "r5d.24xlarge", "r5d.metal", "r5dn.large", "r5dn.xlarge", "r5dn.2xlarge", "r5dn.4xlarge", "r5dn.8xlarge", "r5dn.12xlarge", "r5dn.16xlarge", "r5dn.24xlarge", "r5dn.metal", "r5n.large", "r5n.xlarge", "r5n.2xlarge", "r5n.4xlarge", "r5n.8xlarge", "r5n.12xlarge", "r5n.16xlarge", "r5n.24xlarge", "r5n.metal", "r6g.medium", "r6g.large", "r6g.xlarge", "r6g.2xlarge", "r6g.4xlarge", "r6g.8xlarge", "r6g.12xlarge", "r6g.16xlarge", "r6g.metal", "r6gd.medium", "r6gd.large", "r6gd.xlarge", "r6gd.2xlarge", "r6gd.4xlarge", "r6gd.8xlarge", "r6gd.12xlarge", "r6gd.16xlarge", "r6gd.metal", "r6i.large", "r6i.xlarge", "r6i.2xlarge", "r6i.4xlarge", "r6i.8xlarge", "r6i.12xlarge", "r6i.16xlarge", "r6i.24xlarge", "r6i.32xlarge", "r6i.metal", "t1.micro", "t2.nano", "t2.micro", "t2.small", "t2.medium", "t2.large", "t2.xlarge", "t2.2xlarge", "t3.nano", "t3.micro", "t3.small", "t3.medium", "t3.large", "t3.xlarge", "t3.2xlarge", "t3a.nano", "t3a.micro", "t3a.small", "t3a.medium", "t3a.large", "t3a.xlarge", "t3a.2xlarge", "t4g.nano", "t4g.micro", "t4g.small", "t4g.medium", "t4g.large", "t4g.xlarge", "t4g.2xlarge", "u-6tb1.56xlarge", "u-6tb1.112xlarge", "u-9tb1.112xlarge", "u-12tb1.112xlarge", "u-6tb1.metal", "u-9tb1.metal", "u-12tb1.metal", "u-18tb1.metal", "u-24tb1.metal", "vt1.3xlarge", "vt1.6xlarge", "vt1.24xlarge", "x1.16xlarge", "x1.32xlarge", "x1e.xlarge", "x1e.2xlarge", "x1e.4xlarge", "x1e.8xlarge", "x1e.16xlarge", "x1e.32xlarge", "x2iezn.2xlarge", "x2iezn.4xlarge", "x2iezn.6xlarge", "x2iezn.8xlarge", "x2iezn.12xlarge", "x2iezn.metal", "x2gd.medium", "x2gd.large", "x2gd.xlarge", "x2gd.2xlarge", "x2gd.4xlarge", "x2gd.8xlarge", "x2gd.12xlarge", "x2gd.16xlarge", "x2gd.metal", "z1d.large", "z1d.xlarge", "z1d.2xlarge", "z1d.3xlarge", "z1d.6xlarge", "z1d.12xlarge", "z1d.metal", "x2idn.16xlarge", "x2idn.24xlarge", "x2idn.32xlarge", "x2iedn.xlarge", "x2iedn.2xlarge", "x2iedn.4xlarge", "x2iedn.8xlarge", "x2iedn.16xlarge", "x2iedn.24xlarge", "x2iedn.32xlarge", "c6a.large", "c6a.xlarge", "c6a.2xlarge", "c6a.4xlarge", "c6a.8xlarge", "c6a.12xlarge", "c6a.16xlarge", "c6a.24xlarge", "c6a.32xlarge", "c6a.48xlarge", "c6a.metal", "m6a.metal", "i4i.large", "i4i.xlarge", "i4i.2xlarge", "i4i.4xlarge", "i4i.8xlarge", "i4i.16xlarge", "i4i.32xlarge", "i4i.metal", "x2idn.metal", "x2iedn.metal", "c7g.medium", "c7g.large", "c7g.xlarge", "c7g.2xlarge", "c7g.4xlarge", "c7g.8xlarge", "c7g.12xlarge", "c7g.16xlarge", "mac2.metal", "c6id.large", "c6id.xlarge", "c6id.2xlarge", "c6id.4xlarge", "c6id.8xlarge", "c6id.12xlarge", "c6id.16xlarge", "c6id.24xlarge", "c6id.32xlarge", "c6id.metal", "m6id.large", "m6id.xlarge", "m6id.2xlarge", "m6id.4xlarge", "m6id.8xlarge", "m6id.12xlarge", "m6id.16xlarge", "m6id.24xlarge", "m6id.32xlarge", "m6id.metal", "r6id.large", "r6id.xlarge", "r6id.2xlarge", "r6id.4xlarge", "r6id.8xlarge", "r6id.12xlarge", "r6id.16xlarge", "r6id.24xlarge", "r6id.32xlarge", "r6id.metal", "r6a.large", "r6a.xlarge", "r6a.2xlarge", "r6a.4xlarge", "r6a.8xlarge", "r6a.12xlarge", "r6a.16xlarge", "r6a.24xlarge", "r6a.32xlarge", "r6a.48xlarge", "r6a.metal", "p4de.24xlarge", "u-3tb1.56xlarge", "u-18tb1.112xlarge", "u-24tb1.112xlarge", "trn1.2xlarge", "trn1.32xlarge", "hpc6id.32xlarge", "c6in.large", "c6in.xlarge", "c6in.2xlarge", "c6in.4xlarge", "c6in.8xlarge", "c6in.12xlarge", "c6in.16xlarge", "c6in.24xlarge", "c6in.32xlarge", "m6in.large", "m6in.xlarge", "m6in.2xlarge", "m6in.4xlarge", "m6in.8xlarge", "m6in.12xlarge", "m6in.16xlarge", "m6in.24xlarge", "m6in.32xlarge", "m6idn.large", "m6idn.xlarge", "m6idn.2xlarge", "m6idn.4xlarge", "m6idn.8xlarge", "m6idn.12xlarge", "m6idn.16xlarge", "m6idn.24xlarge", "m6idn.32xlarge", "r6in.large", "r6in.xlarge", "r6in.2xlarge", "r6in.4xlarge", "r6in.8xlarge", "r6in.12xlarge", "r6in.16xlarge", "r6in.24xlarge", "r6in.32xlarge", "r6idn.large", "r6idn.xlarge", "r6idn.2xlarge", "r6idn.4xlarge", "r6idn.8xlarge", "r6idn.12xlarge", "r6idn.16xlarge", "r6idn.24xlarge", "r6idn.32xlarge", "c7g.metal", "m7g.medium", "m7g.large", "m7g.xlarge", "m7g.2xlarge", "m7g.4xlarge", "m7g.8xlarge", "m7g.12xlarge", "m7g.16xlarge", "m7g.metal", "r7g.medium", "r7g.large", "r7g.xlarge", "r7g.2xlarge", "r7g.4xlarge", "r7g.8xlarge", "r7g.12xlarge", "r7g.16xlarge", "r7g.metal", "c6in.metal", "m6in.metal", "m6idn.metal", "r6in.metal", "r6idn.metal", "inf2.xlarge", "inf2.8xlarge", "inf2.24xlarge", "inf2.48xlarge", "trn1n.32xlarge", "i4g.large", "i4g.xlarge", "i4g.2xlarge", "i4g.4xlarge", "i4g.8xlarge", "i4g.16xlarge", "hpc7g.4xlarge", "hpc7g.8xlarge", "hpc7g.16xlarge", "c7gn.medium", "c7gn.large", "c7gn.xlarge", "c7gn.2xlarge", "c7gn.4xlarge", "c7gn.8xlarge", "c7gn.12xlarge", "c7gn.16xlarge", "p5.48xlarge", "m7i.large", "m7i.xlarge", "m7i.2xlarge", "m7i.4xlarge", "m7i.8xlarge", "m7i.12xlarge", "m7i.16xlarge", "m7i.24xlarge", "m7i.48xlarge", "m7i-flex.large", "m7i-flex.xlarge", "m7i-flex.2xlarge", "m7i-flex.4xlarge", "m7i-flex.8xlarge", "m7a.medium", "m7a.large", "m7a.xlarge", "m7a.2xlarge", "m7a.4xlarge", "m7a.8xlarge", "m7a.12xlarge", "m7a.16xlarge", "m7a.24xlarge", "m7a.32xlarge", "m7a.48xlarge", "m7a.metal-48xl", "hpc7a.12xlarge", "hpc7a.24xlarge", "hpc7a.48xlarge", "hpc7a.96xlarge", "c7gd.medium", "c7gd.large", "c7gd.xlarge", "c7gd.2xlarge", "c7gd.4xlarge", "c7gd.8xlarge", "c7gd.12xlarge", "c7gd.16xlarge", "m7gd.medium", "m7gd.large", "m7gd.xlarge", "m7gd.2xlarge", "m7gd.4xlarge", "m7gd.8xlarge", "m7gd.12xlarge", "m7gd.16xlarge", "r7gd.medium", "r7gd.large", "r7gd.xlarge", "r7gd.2xlarge", "r7gd.4xlarge", "r7gd.8xlarge", "r7gd.12xlarge", "r7gd.16xlarge", "r7a.medium", "r7a.large", "r7a.xlarge", "r7a.2xlarge", "r7a.4xlarge", "r7a.8xlarge", "r7a.12xlarge", "r7a.16xlarge", "r7a.24xlarge", "r7a.32xlarge", "r7a.48xlarge", "c7i.large", "c7i.xlarge", "c7i.2xlarge", "c7i.4xlarge", "c7i.8xlarge", "c7i.12xlarge", "c7i.16xlarge", "c7i.24xlarge", "c7i.48xlarge", "mac2-m2pro.metal", "r7iz.large", "r7iz.xlarge", "r7iz.2xlarge", "r7iz.4xlarge", "r7iz.8xlarge", "r7iz.12xlarge", "r7iz.16xlarge", "r7iz.32xlarge", "c7a.medium", "c7a.large", "c7a.xlarge", "c7a.2xlarge", "c7a.4xlarge", "c7a.8xlarge", "c7a.12xlarge", "c7a.16xlarge", "c7a.24xlarge", "c7a.32xlarge", "c7a.48xlarge", "c7a.metal-48xl", "r7a.metal-48xl", "r7i.large", "r7i.xlarge", "r7i.2xlarge", "r7i.4xlarge", "r7i.8xlarge", "r7i.12xlarge", "r7i.16xlarge", "r7i.24xlarge", "r7i.48xlarge", "dl2q.24xlarge", "mac2-m2.metal", "i4i.12xlarge", "i4i.24xlarge", "c7i.metal-24xl", "c7i.metal-48xl", "m7i.metal-24xl", "m7i.metal-48xl", "r7i.metal-24xl", "r7i.metal-48xl", "r7iz.metal-16xl", "r7iz.metal-32xl", "c7gd.metal", "m7gd.metal", "r7gd.metal", "g6.xlarge", "g6.2xlarge", "g6.4xlarge", "g6.8xlarge", "g6.12xlarge", "g6.16xlarge", "g6.24xlarge", "g6.48xlarge", "gr6.4xlarge", "gr6.8xlarge", "c7i-flex.large", "c7i-flex.xlarge", "c7i-flex.2xlarge", "c7i-flex.4xlarge", "c7i-flex.8xlarge", "u7i-12tb.224xlarge", "u7in-16tb.224xlarge", "u7in-24tb.224xlarge", "u7in-32tb.224xlarge", "u7ib-12tb.224xlarge", "c7gn.metal", "r8g.medium", "r8g.large", "r8g.xlarge", "r8g.2xlarge", "r8g.4xlarge", "r8g.8xlarge", "r8g.12xlarge", "r8g.16xlarge", "r8g.24xlarge", "r8g.48xlarge", "r8g.metal-24xl", "r8g.metal-48xl", "mac2-m1ultra.metal", "g6e.xlarge", "g6e.2xlarge", "g6e.4xlarge", "g6e.8xlarge", "g6e.12xlarge", "g6e.16xlarge", "g6e.24xlarge", "g6e.48xlarge", "c8g.medium", "c8g.large", "c8g.xlarge", "c8g.2xlarge", "c8g.4xlarge", "c8g.8xlarge", "c8g.12xlarge", "c8g.16xlarge", "c8g.24xlarge", "c8g.48xlarge", "c8g.metal-24xl", "c8g.metal-48xl", "m8g.medium", "m8g.large", "m8g.xlarge", "m8g.2xlarge", "m8g.4xlarge", "m8g.8xlarge", "m8g.12xlarge", "m8g.16xlarge", "m8g.24xlarge", "m8g.48xlarge", "m8g.metal-24xl", "m8g.metal-48xl", "x8g.medium", "x8g.large", "x8g.xlarge", "x8g.2xlarge", "x8g.4xlarge", "x8g.8xlarge", "x8g.12xlarge", "x8g.16xlarge", "x8g.24xlarge", "x8g.48xlarge", "x8g.metal-24xl", "x8g.metal-48xl", "i7ie.large", "i7ie.xlarge", "i7ie.2xlarge", "i7ie.3xlarge", "i7ie.6xlarge", "i7ie.12xlarge", "i7ie.18xlarge", "i7ie.24xlarge", "i7ie.48xlarge", "i8g.large", "i8g.xlarge", "i8g.2xlarge", "i8g.4xlarge", "i8g.8xlarge", "i8g.12xlarge", "i8g.16xlarge", "i8g.24xlarge", "i8g.metal-24xl", "u7i-6tb.112xlarge", "u7i-8tb.112xlarge", "u7inh-32tb.480xlarge", "p5e.48xlarge", "p5en.48xlarge", "f2.12xlarge", "f2.48xlarge", "trn2.48xlarge", "c7i-flex.12xlarge", "c7i-flex.16xlarge", "m7i-flex.12xlarge", "m7i-flex.16xlarge", "i7ie.metal-24xl", "i7ie.metal-48xl", "i8g.48xlarge", "c8gd.medium", "c8gd.large", "c8gd.xlarge", "c8gd.2xlarge", "c8gd.4xlarge", "c8gd.8xlarge", "c8gd.12xlarge", "c8gd.16xlarge", "c8gd.24xlarge", "c8gd.48xlarge", "c8gd.metal-24xl", "c8gd.metal-48xl", "i7i.large", "i7i.xlarge", "i7i.2xlarge", "i7i.4xlarge", "i7i.8xlarge", "i7i.12xlarge", "i7i.16xlarge", "i7i.24xlarge", "i7i.48xlarge", "i7i.metal-24xl", "i7i.metal-48xl", "p6-b200.48xlarge", "m8gd.medium", "m8gd.large", "m8gd.xlarge", "m8gd.2xlarge", "m8gd.4xlarge", "m8gd.8xlarge", "m8gd.12xlarge", "m8gd.16xlarge", "m8gd.24xlarge", "m8gd.48xlarge", "m8gd.metal-24xl", "m8gd.metal-48xl", "r8gd.medium", "r8gd.large", "r8gd.xlarge", "r8gd.2xlarge", "r8gd.4xlarge", "r8gd.8xlarge", "r8gd.12xlarge", "r8gd.16xlarge", "r8gd.24xlarge", "r8gd.48xlarge", "r8gd.metal-24xl", "r8gd.metal-48xl", "c8gn.medium", "c8gn.large", "c8gn.xlarge", "c8gn.2xlarge", "c8gn.4xlarge", "c8gn.8xlarge", "c8gn.12xlarge", "c8gn.16xlarge", "c8gn.24xlarge", "c8gn.48xlarge", "c8gn.metal-24xl", "c8gn.metal-48xl", "f2.6xlarge", "p6e-gb200.36xlarge", "g6f.large", "g6f.xlarge", "g6f.2xlarge", "g6f.4xlarge", "gr6f.4xlarge", "p5.4xlarge", "r8i.large", "r8i.xlarge", "r8i.2xlarge", "r8i.4xlarge", "r8i.8xlarge", "r8i.12xlarge", "r8i.16xlarge", "r8i.24xlarge", "r8i.32xlarge", "r8i.48xlarge", "r8i.96xlarge", "r8i.metal-48xl", "r8i.metal-96xl", "r8i-flex.large", "r8i-flex.xlarge", "r8i-flex.2xlarge", "r8i-flex.4xlarge", "r8i-flex.8xlarge", "r8i-flex.12xlarge", "r8i-flex.16xlarge", "m8i.large", "m8i.xlarge", "m8i.2xlarge", "m8i.4xlarge", "m8i.8xlarge", "m8i.12xlarge", "m8i.16xlarge", "m8i.24xlarge", "m8i.32xlarge", "m8i.48xlarge", "m8i.96xlarge", "m8i.metal-48xl", "m8i.metal-96xl", "m8i-flex.large", "m8i-flex.xlarge", "m8i-flex.2xlarge", "m8i-flex.4xlarge", "m8i-flex.8xlarge", "m8i-flex.12xlarge", "m8i-flex.16xlarge", "i8ge.large", "i8ge.xlarge", "i8ge.2xlarge", "i8ge.3xlarge", "i8ge.6xlarge", "i8ge.12xlarge", "i8ge.18xlarge", "i8ge.24xlarge", "i8ge.48xlarge", "i8ge.metal-24xl", "i8ge.metal-48xl", "mac-m4.metal", "mac-m4pro.metal", "r8gn.medium", "r8gn.large", "r8gn.xlarge", "r8gn.2xlarge", "r8gn.4xlarge", "r8gn.8xlarge", "r8gn.12xlarge", "r8gn.16xlarge", "r8gn.24xlarge", "r8gn.48xlarge", "r8gn.metal-24xl", "r8gn.metal-48xl"] | None = None
    """
    The instance type.

    For more information, see
    `Instance types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html>`_
    in the *Amazon EC2 User Guide*.
    """
    CurrentGeneration: bool | None = None
    """
    Indicates whether the instance type is current generation.
    """
    FreeTierEligible: bool | None = None
    """
    Indicates whether the instance type is eligible for the free tier.
    """
    SupportedUsageClasses: List[Literal["spot", "on-demand", "capacity-block"]] | None = None
    """
    Indicates whether the instance type is offered for spot, On-Demand, or Capacity
    Blocks.
    """
    SupportedRootDeviceTypes: List[Literal["ebs", "instance-store"]] | None = None
    """
    The supported root device types.
    """
    SupportedVirtualizationTypes: List[Literal["hvm", "paravirtual"]] | None = None
    """
    The supported virtualization types.
    """
    BareMetal: bool | None = None
    """
    Indicates whether the instance is a bare metal instance type.
    """
    Hypervisor: Literal["nitro", "xen"] | None = None
    """
    The hypervisor for the instance type.
    """
    ProcessorInfo: EC2ProcessorInfo | None = None
    """
    Describes the processor.
    """
    VCpuInfo: EC2VCpuInfo | None = None
    """
    Describes the vCPU configurations for the instance type.
    """
    MemoryInfo: EC2MemoryInfo | None = None
    """
    Describes the memory for the instance type.
    """
    InstanceStorageSupported: bool | None = None
    """
    Indicates whether instance storage is supported.
    """
    InstanceStorageInfo: EC2InstanceStorageInfo | None = None
    """
    Describes the instance storage for the instance type.
    """
    EbsInfo: EC2EbsInfo | None = None
    """
    Describes the Amazon EBS settings for the instance type.
    """
    NetworkInfo: EC2NetworkInfo | None = None
    """
    Describes the network settings for the instance type.
    """
    GpuInfo: EC2GpuInfo | None = None
    """
    Describes the GPU accelerator settings for the instance type.
    """
    FpgaInfo: EC2FpgaInfo | None = None
    """
    Describes the FPGA accelerator settings for the instance type.
    """
    PlacementGroupInfo: EC2PlacementGroupInfo | None = None
    """
    Describes the placement group settings for the instance type.
    """
    InferenceAcceleratorInfo: EC2InferenceAcceleratorInfo | None = None
    """
    Describes the Inference accelerator settings for the instance type.
    """
    HibernationSupported: bool | None = None
    """
    Indicates whether On-Demand hibernation is supported.
    """
    BurstablePerformanceSupported: bool | None = None
    """
    Indicates whether the instance type is a burstable performance T instance type.

    For more information, see
    `Burstable performance instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html>`_.
    """
    DedicatedHostsSupported: bool | None = None
    """
    Indicates whether Dedicated Hosts are supported on the instance type.
    """
    AutoRecoverySupported: bool | None = None
    """
    Indicates whether Amazon CloudWatch action based recovery is supported.
    """
    SupportedBootModes: List[Literal["legacy-bios", "uefi"]] | None = None
    """
    The supported boot modes.

    For more information, see
    `Boot modes <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html>`_
    in the *Amazon EC2 User Guide*.
    """
    NitroEnclavesSupport: Literal["unsupported", "supported"] | None = None
    """
    Indicates whether Nitro Enclaves is supported.
    """
    NitroTpmSupport: Literal["unsupported", "supported"] | None = None
    """
    Indicates whether NitroTPM is supported.
    """
    NitroTpmInfo: EC2NitroTpmInfo | None = None
    """
    Describes the supported NitroTPM versions for the instance type.
    """
    MediaAcceleratorInfo: EC2MediaAcceleratorInfo | None = None
    """
    Describes the media accelerator settings for the instance type.
    """
    NeuronInfo: EC2NeuronInfo | None = None
    """
    Describes the Neuron accelerator settings for the instance type.
    """
    PhcSupport: Literal["unsupported", "supported"] | None = None
    """
    Indicates whether a local Precision Time Protocol (PTP) hardware clock (PHC) is
    supported.
    """
    RebootMigrationSupport: Literal["unsupported", "supported"] | None = None
    """
    Indicates whether reboot migration during a user-initiated reboot is supported for
    instances that have a scheduled ``system-reboot`` event.

    For more information, see
    `Enable or disable reboot migration <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/schedevents_actions_reboot.html#reboot-migration>`_
    in the
    *Amazon EC2 User Guide*.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`InstanceType` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.InstanceType

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the :py:attr:`InstanceType`
        attribute.

        Returns:
            The name of the model instance.
        """
        return self.InstanceType

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`InstanceType` attribute.
        """
        return hash(self.InstanceType)

    @cached_property
    def instances(self) -> List["Instance"] | None:
        """
        Return the :py:class:`Instance` objects that have this instance type, 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(
                {
                    "Filters": [
                        {"Name": "instance-type", "Values": [self.InstanceType]}
                    ],
                }
            )
        except AttributeError:
            return []
        return Instance.objects.using(self.session).list(**pk)  # type: ignore[arg-type]


class TagSpecification(TagsDictMixin, Boto3Model):
    """
    The tags to apply to a resource when the resource is being created. When you specify
    a tag, you must specify the resource type to tag, otherwise the request will fail.

    The ``Valid Values`` lists all the resource types that can be tagged. However, the action you're using might not support
    tagging all of these resource types. If you try to tag a resource type that is unsupported for the action you're using,
    you'll get an error.
    """

    tag_class: ClassVar[Type] = Tag
    ResourceType: Literal["capacity-reservation", "client-vpn-endpoint", "customer-gateway", "carrier-gateway", "coip-pool", "declarative-policies-report", "dedicated-host", "dhcp-options", "egress-only-internet-gateway", "elastic-ip", "elastic-gpu", "export-image-task", "export-instance-task", "fleet", "fpga-image", "host-reservation", "image", "image-usage-report", "import-image-task", "import-snapshot-task", "instance", "instance-event-window", "internet-gateway", "ipam", "ipam-pool", "ipam-scope", "ipv4pool-ec2", "ipv6pool-ec2", "key-pair", "launch-template", "local-gateway", "local-gateway-route-table", "local-gateway-virtual-interface", "local-gateway-virtual-interface-group", "local-gateway-route-table-vpc-association", "local-gateway-route-table-virtual-interface-group-association", "natgateway", "network-acl", "network-interface", "network-insights-analysis", "network-insights-path", "network-insights-access-scope", "network-insights-access-scope-analysis", "outpost-lag", "placement-group", "prefix-list", "replace-root-volume-task", "reserved-instances", "route-table", "security-group", "security-group-rule", "service-link-virtual-interface", "snapshot", "spot-fleet-request", "spot-instances-request", "subnet", "subnet-cidr-reservation", "traffic-mirror-filter", "traffic-mirror-session", "traffic-mirror-target", "transit-gateway", "transit-gateway-attachment", "transit-gateway-connect-peer", "transit-gateway-multicast-domain", "transit-gateway-policy-table", "transit-gateway-route-table", "transit-gateway-route-table-announcement", "volume", "vpc", "vpc-endpoint", "vpc-endpoint-connection", "vpc-endpoint-service", "vpc-endpoint-service-permission", "vpc-peering-connection", "vpn-connection", "vpn-gateway", "vpc-flow-log", "capacity-reservation-fleet", "traffic-mirror-filter-rule", "vpc-endpoint-connection-device-type", "verified-access-instance", "verified-access-group", "verified-access-endpoint", "verified-access-policy", "verified-access-trust-provider", "vpn-connection-device-type", "vpc-block-public-access-exclusion", "route-server", "route-server-endpoint", "route-server-peer", "ipam-resource-discovery", "ipam-resource-discovery-association", "instance-connect-endpoint", "verified-access-endpoint-target", "ipam-external-resource-verification-token", "capacity-block", "mac-modification-task"] | None = None
    """
    The type of resource to tag on creation.
    """
    Tags: List[Tag] | None = None
    """
    The tags to apply to the resource.
    """


class Snapshot(TagsDictMixin, PrimaryBoto3Model):
    """
    Describes a snapshot.
    """

    tag_class: ClassVar[Type] = Tag
    manager_class: ClassVar[Type[Boto3ModelManager]] = SnapshotManager

    OwnerAlias: str = Field(default=None, frozen=True)
    """
    The Amazon Web Services owner alias, from an Amazon-maintained list (``amazon``).

    This is not the user-configured Amazon Web Services account alias set using the IAM
    console.
    """
    OutpostArn: str | None = None
    """
    The ARN of the Outpost on which the snapshot is stored.

    For more information, see
    `Amazon EBS local snapshots on Outposts <https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html>`_
    in the *Amazon EBS User Guide*.
    """
    Tags: List[Tag] = Field(default_factory=list, frozen=True)
    """
    Any tags assigned to the snapshot.
    """
    StorageTier: Literal["archive", "standard"] = Field(default=None, frozen=True)
    """
    The storage tier in which the snapshot is stored.

    ``standard`` indicates that the snapshot is stored in the standard
    snapshot storage tier and that it is ready for use. ``archive`` indicates that the snapshot is currently archived and
    that it must be restored before it can be used.
    """
    RestoreExpiryTime: datetime = Field(default=None, frozen=True)
    """
    Only for archived snapshots that are temporarily restored.

    Indicates the date and time when a temporarily restored snapshot will be
    automatically re-archived.
    """
    SseType: Literal["sse-ebs", "sse-kms", "none"] = Field(default=None, frozen=True)
    """
    Reserved for future use.
    """
    AvailabilityZone: str = Field(default=None, frozen=True)
    """
    The Availability Zone or Local Zone of the snapshot.

    For example, ``us-west-1a`` (Availability Zone) or ``us-
    west-2-lax-1a`` (Local Zone).
    """
    TransferType: Literal["time-based", "standard"] = Field(default=None, frozen=True)
    """
    Only for snapshot copies.
    """
    CompletionDurationMinutes: int = Field(default=None, frozen=True)
    """
    Only for snapshot copies created with time-based snapshot copy operations.
    """
    CompletionTime: datetime = Field(default=None, frozen=True)
    """
    The time stamp when the snapshot was completed.
    """
    FullSnapshotSizeInBytes: int = Field(default=None, frozen=True)
    """
    The full size of the snapshot, in bytes.
    """
    SnapshotId: str = Field(default=None, frozen=True)
    """
    The ID of the snapshot.

    Each snapshot receives a unique identifier when it is created.
    """
    VolumeId: str | None = None
    """
    The ID of the volume that was used to create the snapshot.

    Snapshots created by a copy snapshot operation have an arbitrary volume ID that you
    should not use for any purpose.
    """
    State: Literal["pending", "completed", "error", "recoverable", "recovering"] = (
        Field(default=None, frozen=True)
    )
    """
    The snapshot state.
    """
    StateMessage: str = Field(default=None, frozen=True)
    """
    Encrypted Amazon EBS snapshots are copied asynchronously.

    If a snapshot copy operation fails (for example, if the proper KMS permissions are
    not obtained) this field displays error state details to help you diagnose why the
    error occurred. This parameter is only returned by DescribeSnapshots.
    """
    StartTime: datetime = Field(default=None, frozen=True)
    """
    The time stamp when the snapshot was initiated.
    """
    Progress: str = Field(default=None, frozen=True)
    """
    The progress of the snapshot, as a percentage.
    """
    OwnerId: str = Field(default=None, frozen=True)
    """
    The ID of the Amazon Web Services account that owns the EBS snapshot.
    """
    Description: str | None = None
    """
    The description for the snapshot.
    """
    VolumeSize: int = Field(default=None, frozen=True)
    """
    The size of the volume, in GiB.
    """
    Encrypted: bool = Field(default=None, frozen=True)
    """
    Indicates whether the snapshot is encrypted.
    """
    KmsKeyId: str = Field(default=None, frozen=True)
    """
    The Amazon Resource Name (ARN) of the KMS key that was used to protect the volume
    encryption key for the parent volume.
    """
    DataEncryptionKeyId: str = Field(default=None, frozen=True)
    """
    The data encryption key identifier for the snapshot.

    This value is a unique identifier that corresponds to the data encryption key that
    was used to encrypt the original volume or snapshot copy. Because data encryption
    keys are inherited by volumes created from snapshots, and vice versa, if snapshots
    share the same data encryption key identifier, then they belong to the same
    volume/snapshot lineage. This parameter is only returned by DescribeSnapshots.
    """

    @property
    def pk(self) -> str | None:
        """
        Return the primary key of the model.   This is the value of the
        :py:attr:`SnapshotId` attribute.

        Returns:
            The primary key of the model instance.
        """
        return self.SnapshotId

    @property
    def name(self) -> str | None:
        """
        Return the name of the model.   This is the value of the
        :py:attr:`self.tags["Name"] if "Name" in self.tags else None` attribute.

        Returns:
            The name of the model instance.
        """
        return self.self.tags["Name"] if "Name" in self.tags else None

    def __hash__(self) -> int:
        """
        Return the hash of the model.

        This is the value of the
        :py:attr:`SnapshotId` attribute.
        """
        return hash(self.SnapshotId)

    @cached_property
    def ami(self) -> Optional["AMI"]:
        """
        Return the :py:class:`AMI` object that this snapshot belongs to, 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(
                {
                    "ImageId": self.SnapshotId,
                }
            )
        except AttributeError:
            return None
        return AMI.objects.using(self.session).get(**pk)  # type: ignore[arg-type]

    @cached_property
    def instances(self) -> List["Instance"] | None:
        """
        Return the :py:class:`Instance` objects that this snapshot belongs to, 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(
                {
                    "Filters": [
                        {
                            "Name": "block-device-mapping.snapshot-id",
                            "Values": [self.SnapshotId],
                        }
                    ],
                }
            )
        except AttributeError:
            return []
        return Instance.objects.using(self.session).list(**pk)  # type: ignore[arg-type]

    def copy(self) -> "str":
        """
        Copy the snapshot.
        """

        return (
            cast("SnapshotManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .copy(
                self.SourceRegion,
                self.SourceSnapshotId,
            )
        )

    def lock(self) -> "LockSnapshotResult":
        """
        Lock the snapshot.
        """

        return (
            cast("SnapshotManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .lock(
                self.SnapshotId,
            )
        )

    def unlock(self) -> "str":
        """
        Unlock the snapshot.
        """

        return (
            cast("SnapshotManager", self.objects)  # type: ignore[attr-defined]
            .using(self.session)
            .unlock(
                self.SnapshotId,
            )
        )


# =======================
# Request/Response Models
# =======================


class DescribeVpcsResult(Boto3Model):
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """
    Vpcs: List["Vpc"] | None = None
    """
    Information about the VPCs.
    """


class AttributeBooleanValue(Boto3Model):
    """
    Describes a value for a resource attribute that is a Boolean value.
    """

    Value: bool | None = None
    """
    The attribute value.

    The valid values are ``true`` or ``false``.
    """


class DescribeVpcAttributeResult(Boto3Model):
    EnableDnsHostnames: AttributeBooleanValue | None = None
    """
    Indicates whether the instances launched in the VPC get DNS hostnames.

    If this attribute is ``true``, instances in the
    VPC get DNS hostnames; otherwise, they do not.
    """
    EnableDnsSupport: AttributeBooleanValue | None = None
    """
    Indicates whether DNS resolution is enabled for the VPC.

    If this attribute is ``true``, the Amazon DNS server resolves
    DNS hostnames for your instances to their corresponding IP addresses; otherwise, it does not.
    """
    EnableNetworkAddressUsageMetrics: AttributeBooleanValue | None = None
    """
    Indicates whether Network Address Usage metrics are enabled for your VPC.
    """
    VpcId: str | None = None
    """
    The ID of the VPC.
    """


class DescribeSubnetsResult(Boto3Model):
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """
    Subnets: List["Subnet"] | None = None
    """
    Information about the subnets.
    """


class CreateSecurityGroupResult(TagsDictMixin, Boto3Model):
    tag_class: ClassVar[Type] = Tag
    GroupId: str | None = None
    """
    The ID of the security group.
    """
    Tags: List[Tag] | None = None
    """
    The tags assigned to the security group.
    """
    SecurityGroupArn: str | None = None
    """
    The security group ARN.
    """


class DeleteSecurityGroupResult(Boto3Model):
    Return: bool | None = None
    """
    Returns ``true`` if the request succeeds; otherwise, returns an error.
    """
    GroupId: str | None = None
    """
    The ID of the deleted security group.
    """


class DescribeSecurityGroupsResult(Boto3Model):
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """
    SecurityGroups: List["SecurityGroup"] | None = None
    """
    Information about the security groups.
    """


class RevokedSecurityGroupRule(Boto3Model):
    """A security group rule removed with
    `RevokeSecurityGroupEgress <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RevokeSecurityGroupEgress.html>`_
    or `RevokeSecurityGroupIngress <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RevokeSecurityGroupIngress.ht
    ml>`_.
    """

    SecurityGroupRuleId: str | None = None
    """
    A security group rule ID.
    """
    GroupId: str | None = None
    """
    A security group ID.
    """
    IsEgress: bool | None = None
    """
    Defines if a security group rule is an outbound rule.
    """
    IpProtocol: str | None = None
    """
    The security group rule's protocol.
    """
    FromPort: int | None = None
    """
    The 'from' port number of the security group rule.
    """
    ToPort: int | None = None
    """
    The 'to' port number of the security group rule.
    """
    CidrIpv4: str | None = None
    """
    The IPv4 CIDR of the traffic source.
    """
    CidrIpv6: str | None = None
    """
    The IPv6 CIDR of the traffic source.
    """
    PrefixListId: str | None = None
    """
    The ID of a prefix list that's the traffic source.
    """
    ReferencedGroupId: str | None = None
    """
    The ID of a referenced security group.
    """
    Description: str | None = None
    """
    A description of the revoked security group rule.
    """


class RevokeSecurityGroupIngressResult(Boto3Model):
    Return: bool | None = None
    """
    Returns ``true`` if the request succeeds; otherwise, returns an error.
    """
    UnknownIpPermissions: List["IpPermission"] | None = None
    """
    The inbound rules that were unknown to the service.

    In some cases, ``unknownIpPermissionSet`` might be in a different
    format from the request parameter.
    """
    RevokedSecurityGroupRules: List["RevokedSecurityGroupRule"] | None = None
    """
    Details about the revoked security group rules.
    """


class ReferencedSecurityGroup(Boto3Model):
    """
    Describes the security group that is referenced in the security group rule.
    """

    GroupId: str | None = None
    """
    The ID of the security group.
    """
    PeeringStatus: str | None = None
    """
    The status of a VPC peering connection, if applicable.
    """
    UserId: str | None = None
    """
    The Amazon Web Services account ID.
    """
    VpcId: str | None = None
    """
    The ID of the VPC.
    """
    VpcPeeringConnectionId: str | None = None
    """
    The ID of the VPC peering connection (if applicable).
    """


class SecurityGroupRule(TagsDictMixin, Boto3Model):
    """
    Describes a security group rule.
    """

    tag_class: ClassVar[Type] = Tag
    SecurityGroupRuleId: str | None = None
    """
    The ID of the security group rule.
    """
    GroupId: str | None = None
    """
    The ID of the security group.
    """
    GroupOwnerId: str | None = None
    """
    The ID of the Amazon Web Services account that owns the security group.
    """
    IsEgress: bool | None = None
    """
    Indicates whether the security group rule is an outbound rule.
    """
    IpProtocol: str | None = None
    """
The IP protocol name (``tcp``, ``udp``, ``icmp``, ``icmpv6``) or number (see `Protocol
Numbers <http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml>`_).
    """
    FromPort: int | None = None
    """
    If the protocol is TCP or UDP, this is the start of the port range.

    If the protocol is ICMP or ICMPv6, this is the ICMP type or -1 (all ICMP types).
    """
    ToPort: int | None = None
    """
    If the protocol is TCP or UDP, this is the end of the port range.

    If the protocol is ICMP or ICMPv6, this is the ICMP code or -1 (all ICMP codes). If
    the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP
    codes).
    """
    CidrIpv4: str | None = None
    """
    The IPv4 CIDR range.
    """
    CidrIpv6: str | None = None
    """
    The IPv6 CIDR range.
    """
    PrefixListId: str | None = None
    """
    The ID of the prefix list.
    """
    ReferencedGroupInfo: ReferencedSecurityGroup | None = None
    """
    Describes the security group that is referenced in the rule.
    """
    Description: str | None = None
    """
    The security group rule description.
    """
    Tags: List[Tag] | None = None
    """
    The tags applied to the security group rule.
    """
    SecurityGroupRuleArn: str | None = None
    """
    The ARN of the security group rule.
    """


class AuthorizeSecurityGroupIngressResult(Boto3Model):
    Return: bool | None = None
    """
    Returns ``true`` if the request succeeds; otherwise, returns an error.
    """
    SecurityGroupRules: List["SecurityGroupRule"] | None = None
    """
    Information about the inbound (ingress) security group rules that were added.
    """


class CreateNetworkAclResult(Boto3Model):
    NetworkAclInstance: NetworkAcl = Field(default=None, alias="NetworkAcl")
    """
    Information about the network ACL.
    """
    ClientToken: str | None = None
    """
    Unique, case-sensitive identifier to ensure the idempotency of the request.

    Only returned if a client token was provided in the request.
    """


class DescribeNetworkAclsResult(Boto3Model):
    NetworkAcls: List["NetworkAcl"] | None = None
    """
    Information about the network ACLs.
    """
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """


class CreateImageResult(Boto3Model):
    ImageId: str | None = None
    """
    The ID of the new AMI.
    """


class DeleteSnapshotReturnCode(Boto3Model):
    """
    The snapshot ID and its deletion result code.
    """

    SnapshotId: str | None = None
    """
    The ID of the snapshot.
    """
    ReturnCode: Literal["success", "skipped", "missing-permissions", "internal-error", "client-error"] | None = None
    """
    The result code from the snapshot deletion attempt.

    Possible values:
    """


class DeregisterImageResult(Boto3Model):
    Return: bool | None = None
    """
    Returns ``true`` if the request succeeds; otherwise, it returns an error.
    """
    DeleteSnapshotResults: List["DeleteSnapshotReturnCode"] | None = None
    """
    The deletion result for each snapshot associated with the AMI, including the
    snapshot ID and its success or error code.
    """


class DescribeImagesResult(Boto3Model):
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """
    Images: List["AMI"] | None = None
    """
    Information about the images.
    """


class CopyImageResult(Boto3Model):
    """
    Contains the output of CopyImage.
    """

    ImageId: str | None = None
    """
    The ID of the new AMI.
    """


class EnableImageDeregistrationProtectionResult(Boto3Model):
    Return: str | None = None
    """
    Returns ``true`` if the request succeeds; otherwise, it returns an error.
    """


class DisableImageDeregistrationProtectionResult(Boto3Model):
    Return: str | None = None
    """
    Returns ``true`` if the request succeeds; otherwise, it returns an error.
    """


class ElasticGpuSpecification(Boto3Model):
    """
    Amazon Elastic Graphics reached end of life on January 8, 2024.

    A specification for an Elastic Graphics accelerator.
    """

    Type: str
    """
    The type of Elastic Graphics accelerator.
    """


class ElasticInferenceAccelerator(Boto3Model):
    """
    Amazon Elastic Inference is no longer available.

    Describes an elastic inference accelerator.
    """

    Type: str
    """
    The type of elastic inference accelerator.

    The possible values are ``eia1.medium``, ``eia1.large``, ``eia1.xlarge``,
    ``eia2.medium``, ``eia2.large``, and ``eia2.xlarge``.
    """
    Count: int | None = None
    """
    The number of elastic inference accelerators to attach to the instance.
    """


class EC2LaunchTemplateSpecification(Boto3Model):
    """
    Describes the launch template to use.
    """

    LaunchTemplateId: str | None = None
    """
    The ID of the launch template.
    """
    LaunchTemplateName: str | None = None
    """
    The name of the launch template.
    """
    Version: str | None = None
    """
    The launch template version number, ``$Latest``, or ``$Default``.
    """


class SpotMarketOptions(Boto3Model):
    """
    The options for Spot Instances.
    """

    MaxPrice: str | None = None
    """
    The maximum hourly price that you're willing to pay for a Spot Instance.

    We do not recommend using this parameter because it can lead to increased
    interruptions. If you do not specify this parameter, you will pay the current Spot
    price.
    """
    SpotInstanceType: Literal["one-time", "persistent"] | None = None
    """
    The Spot Instance request type.

    For
    `RunInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances>`_, persistent Spot Instance
    requests are only supported when the instance interruption behavior is either ``hibernate`` or ``stop``.
    """
    BlockDurationMinutes: int | None = None
    """
    Deprecated.
    """
    ValidUntil: datetime | None = None
    """
    The end date of the request, in UTC format (*YYYY*-*MM*-*DD*T*HH*:*MM*:*SS*Z).

    Supported only for persistent requests.
    """
    InstanceInterruptionBehavior: Literal["hibernate", "stop", "terminate"] | None = None
    """
    The behavior when a Spot Instance is interrupted.
    """


class InstanceMarketOptionsRequest(Boto3Model):
    """
    Describes the market (purchasing) option for the instances.
    """

    MarketType: Literal["spot", "capacity-block"] | None = None
    """
    The market type.
    """
    SpotOptions: SpotMarketOptions | None = None
    """
    The options for Spot Instances.
    """


class CreditSpecificationRequest(Boto3Model):
    """
    The credit option for CPU usage of a T instance.
    """

    CpuCredits: str
    """
    The credit option for CPU usage of a T instance.
    """


class LicenseConfigurationRequest(Boto3Model):
    """
    Describes a license configuration.
    """

    LicenseConfigurationArn: str | None = None
    """
    The Amazon Resource Name (ARN) of the license configuration.
    """


class RunInstancesMonitoringEnabled(Boto3Model):
    """
    Describes the monitoring of an instance.
    """

    Enabled: bool
    """
    Indicates whether detailed monitoring is enabled.

    Otherwise, basic monitoring is enabled.
    """


class CpuOptionsRequest(Boto3Model):
    """
    The CPU options for the instance.

    Both the core count and threads per core must be specified in the request.
    """

    CoreCount: int | None = None
    """
    The number of CPU cores for the instance.
    """
    ThreadsPerCore: int | None = None
    """
    The number of threads per CPU core.

    To disable multithreading for the instance, specify a value of ``1``. Otherwise,
    specify the default value of ``2``.
    """
    AmdSevSnp: Literal["enabled", "disabled"] | None = None
    """
    Indicates whether to enable the instance for AMD SEV-SNP.

    AMD SEV-SNP is supported with M6a, R6a, and C6a instance types only. For more
    information, see `AMD SEV-SNP
    <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sev-snp.html>`_.
    """


class EC2CapacityReservationTarget(Boto3Model):
    """
    Describes a target Capacity Reservation or Capacity Reservation group.
    """

    CapacityReservationId: str | None = None
    """
    The ID of the Capacity Reservation in which to run the instance.
    """
    CapacityReservationResourceGroupArn: str | None = None
    """
    The ARN of the Capacity Reservation resource group in which to run the instance.
    """


class CapacityReservationSpecification(Boto3Model):
    """
    Describes an instance's Capacity Reservation targeting option.

    Use the ``CapacityReservationPreference`` parameter to configure the instance to run as an On-Demand Instance, to run in
    any ``open`` Capacity Reservation that has matching attributes, or to run only in a Capacity Reservation or Capacity
    Reservation group. Use the ``CapacityReservationTarget`` parameter to explicitly target a specific Capacity Reservation
    or a Capacity Reservation group.

    You can only specify ``CapacityReservationPreference`` and ``CapacityReservationTarget`` if the
    ``CapacityReservationPreference`` is ``capacity-reservations-only``.
    """

    CapacityReservationPreference: Literal["capacity-reservations-only", "open", "none"] | None = None
    """
    Indicates the instance's Capacity Reservation preferences.

    Possible preferences include:
    """
    CapacityReservationTarget: EC2CapacityReservationTarget | None = None
    """
    Information about the target Capacity Reservation or Capacity Reservation group.
    """


class HibernationOptionsRequest(Boto3Model):
    """
    Indicates whether your instance is configured for hibernation.

    This parameter is valid only if the instance meets the
    `hibernation prerequisites <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html>`_.
    For    more information, see
    `Hibernate your Amazon EC2 instance <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html>`_
    in the *Amazon EC2 User Guide*.
    """

    Configured: bool | None = None
    """
    Set to ``true`` to enable your instance for hibernation.
    """


class InstanceMetadataOptionsRequest(Boto3Model):
    """
    The metadata options for the instance.
    """

    HttpTokens: Literal["optional", "required"] | None = None
    """
    Indicates whether IMDSv2 is required.
    """
    HttpPutResponseHopLimit: int | None = None
    """
    The maximum number of hops that the metadata token can travel.
    """
    HttpEndpoint: Literal["disabled", "enabled"] | None = None
    """
    Enables or disables the HTTP metadata endpoint on your instances.
    """
    HttpProtocolIpv6: Literal["disabled", "enabled"] | None = None
    """
    Enables or disables the IPv6 endpoint for the instance metadata service.
    """
    InstanceMetadataTags: Literal["disabled", "enabled"] | None = None
    """
    Set to ``enabled`` to allow access to instance tags from the instance metadata.

    Set to ``disabled`` to turn off access
    to instance tags from the instance metadata. For more information, see `Work with instance tags using the instance
    metadata <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#work-with-tags-in-IMDS>`_.
    """


class EnclaveOptionsRequest(Boto3Model):
    """
    Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.

    For more information, see
    `What is Amazon Web Services Nitro Enclaves? <https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html>`_
    in the *Amazon
    Web Services Nitro Enclaves User Guide*.
    """

    Enabled: bool | None = None
    """
    To enable the instance for Amazon Web Services Nitro Enclaves, set this parameter to
    ``true``.
    """


class PrivateDnsNameOptionsRequest(Boto3Model):
    """
    Describes the options for instance hostnames.
    """

    HostnameType: Literal["ip-name", "resource-name"] | None = None
    """
    The type of hostname for EC2 instances.

    For IPv4 only subnets, an instance DNS name must be based on the instance IPv4
    address. For IPv6 only subnets, an instance DNS name must be based on the instance
    ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4
    address or the instance ID.
    """
    EnableResourceNameDnsARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS A
    records.
    """
    EnableResourceNameDnsAAAARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA
    records.
    """


class InstanceMaintenanceOptionsRequest(Boto3Model):
    """
    The maintenance options for the instance.
    """

    AutoRecovery: Literal["disabled", "default"] | None = None
    """
    Disables the automatic recovery behavior of your instance or sets it to default.

    For more information, see
    `Simplified automatic recovery <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-recover.html#instance-
    configuration-recovery>`_.
    """


class InstanceNetworkPerformanceOptionsRequest(Boto3Model):
    """
    Configure network performance options for your instance that are geared towards
    performance improvements based on the workload that it runs.
    """

    BandwidthWeighting: Literal["default", "vpc-1", "ebs-1"] | None = None
    """
    Specify the bandwidth weighting option to boost the associated type of baseline
    bandwidth, as follows:
    """


class OperatorRequest(Boto3Model):
    """
    The service provider that manages the resource.
    """

    Principal: str | None = None
    """
    The service provider that manages the resource.
    """


class Ipv4PrefixSpecificationRequest(Boto3Model):
    """
    Describes the IPv4 prefix option for a network interface.
    """

    Ipv4Prefix: str | None = None
    """
    The IPv4 prefix.

    For information, see
    `Assigning prefixes to network interfaces <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-eni.html>`_
    in the *Amazon EC2 User Guide*.
    """


class Ipv6PrefixSpecificationRequest(Boto3Model):
    """
    Describes the IPv6 prefix option for a network interface.
    """

    Ipv6Prefix: str | None = None
    """
    The IPv6 prefix.
    """


class EnaSrdUdpSpecificationRequest(Boto3Model):
    """
    Configures ENA Express for UDP network traffic from your launch template.
    """

    EnaSrdUdpEnabled: bool | None = None
    """
    Indicates whether UDP traffic uses ENA Express for your instance.

    To ensure that UDP traffic can use ENA Express when
    you launch an instance, you must also set **EnaSrdEnabled** in the **EnaSrdSpecificationRequest** to ``true``.
    """


class EnaSrdSpecificationRequest(Boto3Model):
    """
    Launch instances with ENA Express settings configured from your launch template.
    """

    EnaSrdEnabled: bool | None = None
    """
    Specifies whether ENA Express is enabled for the network interface when you launch
    an instance.
    """
    EnaSrdUdpSpecification: EnaSrdUdpSpecificationRequest | None = None
    """
    Contains ENA Express settings for UDP network traffic for the network interface
    attached to the instance.
    """


class ConnectionTrackingSpecificationRequest(Boto3Model):
    """
    A security group connection tracking specification request that enables you to set
    the idle timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Connection tracking timeouts <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """

    TcpEstablishedTimeout: int | None = None
    """
    Timeout (in seconds) for idle TCP connections in an established state.

    Min: 60 seconds. Max: 432000 seconds (5 days).
    Default: 432000 seconds. Recommended: Less than 432000 seconds.
    """
    UdpStreamTimeout: int | None = None
    """
    Timeout (in seconds) for idle UDP flows classified as streams which have seen more
    than one request-response transaction.

    Min: 60 seconds. Max: 180 seconds (3 minutes). Default: 180 seconds.
    """
    UdpTimeout: int | None = None
    """
    Timeout (in seconds) for idle UDP flows that have seen traffic only in a single
    direction or a single request-response transaction.

    Min: 30 seconds. Max: 60 seconds. Default: 30 seconds.
    """


class InstanceNetworkInterfaceSpecification(Boto3Model):
    """
    Describes a network interface.
    """

    AssociatePublicIpAddress: bool | None = None
    """
    Indicates whether to assign a public IPv4 address to an instance you launch in a
    VPC.

    The public IP address can only be
    assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You
    cannot specify more than one network interface in the request. If launching into a default subnet, the default value is
    ``true``.
    """
    DeleteOnTermination: bool | None = None
    """
    If set to ``true``, the interface is deleted when the instance is terminated.

    You can specify ``true`` only if creating
    a new network interface when launching an instance.
    """
    Description: str | None = None
    """
    The description of the network interface.

    Applies only if creating a network interface when launching an instance.
    """
    DeviceIndex: int | None = None
    """
    The position of the network interface in the attachment order.

    A primary network interface has a device index of 0.
    """
    Groups: List[str] | None = None
    """
    The IDs of the security groups for the network interface.

    Applies only if creating a network interface when launching an instance.
    """
    Ipv6AddressCount: int | None = None
    """
    A number of IPv6 addresses to assign to the network interface.

    Amazon EC2 chooses the IPv6 addresses from the range of the subnet. You cannot
    specify this option and the option to assign specific IPv6 addresses in the same
    request. You can specify this option if you've specified a minimum number of
    instances to launch.
    """
    Ipv6Addresses: List["InstanceIpv6Address"] | None = None
    """
    The IPv6 addresses to assign to the network interface.

    You cannot specify this option and the option to assign a number of IPv6 addresses
    in the same request. You cannot specify this option if you've specified a minimum
    number of instances to launch.
    """
    NetworkInterfaceId: str | None = None
    """
    The ID of the network interface.
    """
    PrivateIpAddress: str | None = None
    """
    The private IPv4 address of the network interface.

    Applies only if creating a network interface when launching an instance. You cannot
    specify this option if you're launching more than one instance in a
    `RunInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html>`_
    request.
    """
    PrivateIpAddresses: List["PrivateIpAddressSpecification"] | None = None
    """
    The private IPv4 addresses to assign to the network interface.

    Only one private IPv4 address can be designated as primary. You cannot specify this
    option if you're launching more than one instance in a
    `RunInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html>`_
    request.
    """
    SecondaryPrivateIpAddressCount: int | None = None
    """
    The number of secondary private IPv4 addresses.

    You can’t specify this parameter and also specify a secondary private IP
    address using the ``PrivateIpAddress`` parameter.
    """
    SubnetId: str | None = None
    """
    The ID of the subnet associated with the network interface.

    Applies only if creating a network interface when launching an instance.
    """
    AssociateCarrierIpAddress: bool | None = None
    """
    Indicates whether to assign a carrier IP address to the network interface.
    """
    InterfaceType: str | None = None
    """
    The type of network interface.
    """
    NetworkCardIndex: int | None = None
    """
    The index of the network card.

    Some instance types support multiple network cards. The primary network interface
    must be assigned to network card index 0. The default is network card index 0.
    """
    Ipv4Prefixes: List["Ipv4PrefixSpecificationRequest"] | None = None
    """
    The IPv4 delegated prefixes to be assigned to the network interface.

    You cannot use this option if you use the
    ``Ipv4PrefixCount`` option.
    """
    Ipv4PrefixCount: int | None = None
    """
    The number of IPv4 delegated prefixes to be automatically assigned to the network
    interface.

    You cannot use this option
    if you use the ``Ipv4Prefix`` option.
    """
    Ipv6Prefixes: List["Ipv6PrefixSpecificationRequest"] | None = None
    """
    The IPv6 delegated prefixes to be assigned to the network interface.

    You cannot use this option if you use the
    ``Ipv6PrefixCount`` option.
    """
    Ipv6PrefixCount: int | None = None
    """
    The number of IPv6 delegated prefixes to be automatically assigned to the network
    interface.

    You cannot use this option
    if you use the ``Ipv6Prefix`` option.
    """
    PrimaryIpv6: bool | None = None
    """
    The primary IPv6 address of the network interface.

    When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be
    made the primary IPv6 address until the instance is terminated or the network
    interface is detached. For more information about primary IPv6 addresses, see
    `RunInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html>`_.
    """
    EnaSrdSpecification: EnaSrdSpecificationRequest | None = None
    """
    Specifies the ENA Express settings for the network interface that's attached to the
    instance.
    """
    ConnectionTrackingSpecification: ConnectionTrackingSpecificationRequest | None = None
    """
    A security group connection tracking specification that enables you to set the
    timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Connection tracking timeouts <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """
    EnaQueueCount: int | None = None
    """
    The number of ENA queues to be created with the instance.
    """


class IamInstanceProfileSpecification(Boto3Model):
    """
    Describes an IAM instance profile.
    """

    Arn: str | None = None
    """
    The Amazon Resource Name (ARN) of the instance profile.
    """
    Name: str | None = None
    """
    The name of the instance profile.
    """


class Reservation(Boto3Model):
    """
    Describes a launch request for one or more instances, and includes owner, requester,
    and security group information that applies to all instances in the launch request.
    """

    ReservationId: str | None = None
    """
    The ID of the reservation.
    """
    OwnerId: str | None = None
    """
    The ID of the Amazon Web Services account that owns the reservation.
    """
    RequesterId: str | None = None
    """
    The ID of the requester that launched the instances on your behalf (for example,
    Amazon Web Services Management Console or Auto Scaling).
    """
    Groups: List["GroupIdentifier"] | None = None
    """
    Not supported.
    """
    Instances: List["Instance"] | None = None
    """
    The instances.
    """


class DescribeInstancesResult(Boto3Model):
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """
    Reservations: List["Reservation"] | None = None
    """
    Information about the reservations.
    """


class InstanceStateChange(Boto3Model):
    """
    Describes an instance state change.
    """

    InstanceId: str | None = None
    """
    The ID of the instance.
    """
    CurrentState: InstanceState | None = None
    """
    The current state of the instance.
    """
    PreviousState: InstanceState | None = None
    """
    The previous state of the instance.
    """


class StartInstancesResult(Boto3Model):
    StartingInstances: List["InstanceStateChange"] | None = None
    """
    Information about the started instances.
    """


class StopInstancesResult(Boto3Model):
    StoppingInstances: List["InstanceStateChange"] | None = None
    """
    Information about the stopped instances.
    """


class TerminateInstancesResult(Boto3Model):
    TerminatingInstances: List["InstanceStateChange"] | None = None
    """
    Information about the terminated instances.
    """


class LaunchTemplateIamInstanceProfileSpecificationRequest(Boto3Model):
    """
    An IAM instance profile.
    """

    Arn: str | None = None
    """
    The Amazon Resource Name (ARN) of the instance profile.
    """
    Name: str | None = None
    """
    The name of the instance profile.
    """


class LaunchTemplateEbsBlockDeviceRequest(Boto3Model):
    """
    The parameters for a block device for an EBS volume.
    """

    Encrypted: bool | None = None
    """
    Indicates whether the EBS volume is encrypted.

    Encrypted volumes can only be attached to instances that support Amazon EBS
    encryption. If you are creating a volume from a snapshot, you can't specify an
    encryption value.
    """
    DeleteOnTermination: bool | None = None
    """
    Indicates whether the EBS volume is deleted on instance termination.
    """
    Iops: int | None = None
    """
    The number of I/O operations per second (IOPS).

    For ``gp3``, ``io1``, and ``io2`` 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.
    """
    KmsKeyId: str | None = None
    """
    Identifier (key ID, key alias, key ARN, or alias ARN) of the customer managed KMS
    key to use for EBS encryption.
    """
    SnapshotId: str | None = None
    """
    The ID of the snapshot.
    """
    VolumeSize: int | None = None
    """
    The size of the volume, in GiBs.

    You must specify either a snapshot ID or a volume size. The following are the supported
    volumes sizes for each volume type:
    """
    VolumeType: Literal["standard", "io1", "io2", "gp2", "sc1", "st1", "gp3"] | 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*.
    """
    Throughput: int | None = None
    """
    The throughput to provision for a ``gp3`` volume, with a maximum of 2,000 MiB/s.
    """
    VolumeInitializationRate: int | None = None
    """
    Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume
    initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon
    S3 to the volume.

    This is also known as *volume initialization*. Specifying a volume initialization
    rate ensures that the volume is initialized at a predictable and consistent rate
    after creation.
    """


class LaunchTemplateBlockDeviceMappingRequest(Boto3Model):
    """
    Describes a block device mapping.
    """

    DeviceName: str | None = None
    """
    The device name (for example, /dev/sdh or xvdh).
    """
    VirtualName: str | None = None
    """
    The virtual device name (ephemeralN).

    Instance store volumes are numbered starting from 0. An instance type with 2
    available instance store volumes can specify mappings for ephemeral0 and ephemeral1.
    The number of available instance store volumes depends on the instance type. After
    you connect to the instance, you must mount the volume.
    """
    Ebs: LaunchTemplateEbsBlockDeviceRequest | None = None
    """
    Parameters used to automatically set up EBS volumes when the instance is launched.
    """
    NoDevice: str | None = None
    """
    To omit the device from the block device mapping, specify an empty string.
    """


class InstanceIpv6AddressRequest(Boto3Model):
    """
    Describes an IPv6 address.
    """

    Ipv6Address: str | None = None
    """
    The IPv6 address.
    """


class LaunchTemplateInstanceNetworkInterfaceSpecificationRequest(Boto3Model):
    """
    The parameters for a network interface.
    """

    AssociateCarrierIpAddress: bool | None = None
    """
    Associates a Carrier IP address with eth0 for a new network interface.
    """
    AssociatePublicIpAddress: bool | None = None
    """
    Associates a public IPv4 address with eth0 for a new network interface.
    """
    DeleteOnTermination: bool | None = None
    """
    Indicates whether the network interface is deleted when the instance is terminated.
    """
    Description: str | None = None
    """
    A description for the network interface.
    """
    DeviceIndex: int | None = None
    """
    The device index for the network interface attachment.

    The primary network interface has a device index of 0. Each
    network interface is of type ``interface``, you must specify a device index. If you create a launch template that
    includes secondary network interfaces but not a primary network interface, then you must add a primary network interface
    as a launch parameter when you launch an instance from the template.
    """
    Groups: List[str] | None = None
    """
    The IDs of one or more security groups.
    """
    InterfaceType: str | None = None
    """
    The type of network interface.

    To create an Elastic Fabric Adapter (EFA), specify ``efa`` or ``efa``. For more
    information, see `Elastic Fabric Adapter for AI/ML and HPC workloads on Amazon
    EC2 <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html>`_ in the *Amazon EC2 User Guide*.
    """
    Ipv6AddressCount: int | None = None
    """
    The number of IPv6 addresses to assign to a network interface.

    Amazon EC2 automatically selects the IPv6 addresses from the subnet range. You can't
    use this option if specifying specific IPv6 addresses.
    """
    Ipv6Addresses: List["InstanceIpv6AddressRequest"] | None = None
    """
    One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet.

    You can't use this option if you're specifying a number of IPv6 addresses.
    """
    NetworkInterfaceId: str | None = None
    """
    The ID of the network interface.
    """
    PrivateIpAddress: str | None = None
    """
    The primary private IPv4 address of the network interface.
    """
    PrivateIpAddresses: List["PrivateIpAddressSpecification"] | None = None
    """
    One or more private IPv4 addresses.
    """
    SecondaryPrivateIpAddressCount: int | None = None
    """
    The number of secondary private IPv4 addresses to assign to a network interface.
    """
    SubnetId: str | None = None
    """
    The ID of the subnet for the network interface.
    """
    NetworkCardIndex: int | None = None
    """
    The index of the network card.

    Some instance types support multiple network cards. The primary network interface
    must be assigned to network card index 0. The default is network card index 0.
    """
    Ipv4Prefixes: List["Ipv4PrefixSpecificationRequest"] | None = None
    """
    One or more IPv4 prefixes to be assigned to the network interface.

    You cannot use this option if you use the
    ``Ipv4PrefixCount`` option.
    """
    Ipv4PrefixCount: int | None = None
    """
    The number of IPv4 prefixes to be automatically assigned to the network interface.

    You cannot use this option if you use
    the ``Ipv4Prefix`` option.
    """
    Ipv6Prefixes: List["Ipv6PrefixSpecificationRequest"] | None = None
    """
    One or more IPv6 prefixes to be assigned to the network interface.

    You cannot use this option if you use the
    ``Ipv6PrefixCount`` option.
    """
    Ipv6PrefixCount: int | None = None
    """
    The number of IPv6 prefixes to be automatically assigned to the network interface.

    You cannot use this option if you use
    the ``Ipv6Prefix`` option.
    """
    PrimaryIpv6: bool | None = None
    """
    The primary IPv6 address of the network interface.

    When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be
    made the primary IPv6 address until the instance is terminated or the network
    interface is detached. For more information about primary IPv6 addresses, see
    `RunInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html>`_.
    """
    EnaSrdSpecification: EnaSrdSpecificationRequest | None = None
    """
    Configure ENA Express settings for your launch template.
    """
    ConnectionTrackingSpecification: ConnectionTrackingSpecificationRequest | None = None
    """
    A security group connection tracking specification that enables you to set the
    timeout for connection tracking on an Elastic network interface.

    For more information, see
    `Idle connection tracking timeout <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html#connection-
    tracking-timeouts>`_ in the *Amazon EC2 User Guide*.
    """
    EnaQueueCount: int | None = None
    """
    The number of ENA queues to be created with the instance.
    """


class LaunchTemplatesMonitoringRequest(Boto3Model):
    """
    Describes the monitoring for the instance.
    """

    Enabled: bool | None = None
    """
    Specify ``true`` to enable detailed monitoring.

    Otherwise, basic monitoring is enabled.
    """


class LaunchTemplatePlacementRequest(Boto3Model):
    """
    Describes the placement of an instance.
    """

    AvailabilityZone: str | None = None
    """
    The Availability Zone for the instance.
    """
    AvailabilityZoneId: str | None = None
    """
    The ID of the Availability Zone for the instance.
    """
    Affinity: str | None = None
    """
    The affinity setting for an instance on a Dedicated Host.
    """
    GroupName: str | None = None
    """
    The name of the placement group for the instance.
    """
    HostId: str | None = None
    """
    The ID of the Dedicated Host for the instance.
    """
    Tenancy: Literal["default", "dedicated", "host"] | None = None
    """
    The tenancy of the instance.

    An instance with a tenancy of dedicated runs on single-tenant hardware.
    """
    SpreadDomain: str | None = None
    """
    Reserved for future use.
    """
    HostResourceGroupArn: str | None = None
    """
    The ARN of the host resource group in which to launch the instances.

    If you specify a host resource group ARN, omit the
    **Tenancy** parameter or set it to ``host``.
    """
    PartitionNumber: int | None = None
    """
    The number of the partition the instance should launch in.

    Valid only if the placement group strategy is set to
    ``partition``.
    """
    GroupId: str | None = None
    """
    The Group Id of a placement group.

    You must specify the Placement Group **Group Id** to launch an instance in a shared
    placement group.
    """


class LaunchTemplateTagSpecificationRequest(TagsDictMixin, Boto3Model):
    """
    The tags specification for the resources that are created during instance launch.
    """

    tag_class: ClassVar[Type] = Tag
    ResourceType: Literal["capacity-reservation", "client-vpn-endpoint", "customer-gateway", "carrier-gateway", "coip-pool", "declarative-policies-report", "dedicated-host", "dhcp-options", "egress-only-internet-gateway", "elastic-ip", "elastic-gpu", "export-image-task", "export-instance-task", "fleet", "fpga-image", "host-reservation", "image", "image-usage-report", "import-image-task", "import-snapshot-task", "instance", "instance-event-window", "internet-gateway", "ipam", "ipam-pool", "ipam-scope", "ipv4pool-ec2", "ipv6pool-ec2", "key-pair", "launch-template", "local-gateway", "local-gateway-route-table", "local-gateway-virtual-interface", "local-gateway-virtual-interface-group", "local-gateway-route-table-vpc-association", "local-gateway-route-table-virtual-interface-group-association", "natgateway", "network-acl", "network-interface", "network-insights-analysis", "network-insights-path", "network-insights-access-scope", "network-insights-access-scope-analysis", "outpost-lag", "placement-group", "prefix-list", "replace-root-volume-task", "reserved-instances", "route-table", "security-group", "security-group-rule", "service-link-virtual-interface", "snapshot", "spot-fleet-request", "spot-instances-request", "subnet", "subnet-cidr-reservation", "traffic-mirror-filter", "traffic-mirror-session", "traffic-mirror-target", "transit-gateway", "transit-gateway-attachment", "transit-gateway-connect-peer", "transit-gateway-multicast-domain", "transit-gateway-policy-table", "transit-gateway-route-table", "transit-gateway-route-table-announcement", "volume", "vpc", "vpc-endpoint", "vpc-endpoint-connection", "vpc-endpoint-service", "vpc-endpoint-service-permission", "vpc-peering-connection", "vpn-connection", "vpn-gateway", "vpc-flow-log", "capacity-reservation-fleet", "traffic-mirror-filter-rule", "vpc-endpoint-connection-device-type", "verified-access-instance", "verified-access-group", "verified-access-endpoint", "verified-access-policy", "verified-access-trust-provider", "vpn-connection-device-type", "vpc-block-public-access-exclusion", "route-server", "route-server-endpoint", "route-server-peer", "ipam-resource-discovery", "ipam-resource-discovery-association", "instance-connect-endpoint", "verified-access-endpoint-target", "ipam-external-resource-verification-token", "capacity-block", "mac-modification-task"] | None = None
    """
    The type of resource to tag.
    """
    Tags: List[Tag] | None = None
    """
    The tags to apply to the resource.
    """


class LaunchTemplateElasticInferenceAccelerator(Boto3Model):
    """
    Amazon Elastic Inference is no longer available.

    Describes an elastic inference accelerator.
    """

    Type: str
    """
    The type of elastic inference accelerator.

    The possible values are eia1.medium, eia1.large, and eia1.xlarge.
    """
    Count: int | None = None
    """
    The number of elastic inference accelerators to attach to the instance.
    """


class LaunchTemplateSpotMarketOptionsRequest(Boto3Model):
    """
    The options for Spot Instances.
    """

    MaxPrice: str | None = None
    """
    The maximum hourly price you're willing to pay for a Spot Instance.

    We do not recommend using this parameter because it
    can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price. If you
    do specify this parameter, it must be more than USD $0.001. Specifying a value below USD $0.001 will result in an
    ``InvalidParameterValue`` error message when the launch template is used to launch an instance.
    """
    SpotInstanceType: Literal["one-time", "persistent"] | None = None
    """
    The Spot Instance request type.
    """
    BlockDurationMinutes: int | None = None
    """
    Deprecated.
    """
    ValidUntil: datetime | None = None
    """
    The end date of the request, in UTC format (*YYYY-MM-DD*T*HH:MM:SS*Z).

    Supported only for persistent requests.
    """
    InstanceInterruptionBehavior: Literal["hibernate", "stop", "terminate"] | None = None
    """
    The behavior when a Spot Instance is interrupted.

    The default is ``terminate``.
    """


class LaunchTemplateInstanceMarketOptionsRequest(Boto3Model):
    """
    The market (purchasing) option for the instances.
    """

    MarketType: Literal["spot", "capacity-block"] | None = None
    """
    The market type.
    """
    SpotOptions: LaunchTemplateSpotMarketOptionsRequest | None = None
    """
    The options for Spot Instances.
    """


class LaunchTemplateCpuOptionsRequest(Boto3Model):
    """
    The CPU options for the instance.

    Both the core count and threads per core must be specified in the request.
    """

    CoreCount: int | None = None
    """
    The number of CPU cores for the instance.
    """
    ThreadsPerCore: int | None = None
    """
    The number of threads per CPU core.

    To disable multithreading for the instance, specify a value of ``1``. Otherwise,
    specify the default value of ``2``.
    """
    AmdSevSnp: Literal["enabled", "disabled"] | None = None
    """
    Indicates whether to enable the instance for AMD SEV-SNP.

    AMD SEV-SNP is supported with M6a, R6a, and C6a instance types only. For more
    information, see `AMD SEV-SNP for Amazon EC2 instances
    <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sev-snp.html>`_.
    """


class LaunchTemplateCapacityReservationSpecificationRequest(Boto3Model):
    """
    Describes an instance's Capacity Reservation targeting option.

    You can specify only one option at a time. Use the
    ``CapacityReservationPreference`` parameter to configure the instance to run in On-Demand capacity or to run in any
    ``open`` Capacity Reservation that has matching attributes (instance type, platform, Availability Zone). Use the
    ``CapacityReservationTarget`` parameter to explicitly target a specific Capacity Reservation or a Capacity Reservation
    group.
    """

    CapacityReservationPreference: Literal["capacity-reservations-only", "open", "none"] | None = None
    """
    Indicates the instance's Capacity Reservation preferences.

    Possible preferences include:
    """
    CapacityReservationTarget: EC2CapacityReservationTarget | None = None
    """
    Information about the target Capacity Reservation or Capacity Reservation group.
    """


class LaunchTemplateLicenseConfigurationRequest(Boto3Model):
    """
    Describes a license configuration.
    """

    LicenseConfigurationArn: str | None = None
    """
    The Amazon Resource Name (ARN) of the license configuration.
    """


class LaunchTemplateHibernationOptionsRequest(Boto3Model):
    """
    Indicates whether the instance is configured for hibernation.

    This parameter is valid only if the instance meets the
    `hibernation prerequisites <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html>`_.
    """

    Configured: bool | None = None
    """
    If you set this parameter to ``true``, the instance is enabled for hibernation.
    """


class LaunchTemplateInstanceMetadataOptionsRequest(Boto3Model):
    """
    The metadata options for the instance.

    For more information, see
    `Use instance metadata to manage your EC2 instance <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html>`_
    in the *Amazon EC2 User
    Guide*.
    """

    HttpTokens: Literal["optional", "required"] | None = None
    """
    Indicates whether IMDSv2 is required.
    """
    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
    """
    Enables or disables the HTTP metadata endpoint on your instances.

    If the parameter is not specified, the default state
    is ``enabled``.
    """
    HttpProtocolIpv6: Literal["disabled", "enabled"] | None = None
    """
    Enables or disables the IPv6 endpoint for the instance metadata service.
    """
    InstanceMetadataTags: Literal["disabled", "enabled"] | None = None
    """
    Set to ``enabled`` to allow access to instance tags from the instance metadata.

    Set to ``disabled`` to turn off access
    to instance tags from the instance metadata. For more information, see `View tags for your EC2 instances using instance
    metadata <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html>`_.
    """


class LaunchTemplateEnclaveOptionsRequest(Boto3Model):
    """
    Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.

    For more information, see
    `What is Nitro Enclaves? <https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html>`_
    in the *Amazon Web Services Nitro
    Enclaves User Guide*.
    """

    Enabled: bool | None = None
    """
    To enable the instance for Amazon Web Services Nitro Enclaves, set this parameter to
    ``true``.
    """


class VCpuCountRangeRequest(Boto3Model):
    """
    The minimum and maximum number of vCPUs.
    """

    Min: int
    """
    The minimum number of vCPUs.

    To specify no minimum limit, specify ``0``.
    """
    Max: int | None = None
    """
    The maximum number of vCPUs.

    To specify no maximum limit, omit this parameter.
    """


class MemoryMiBRequest(Boto3Model):
    """
    The minimum and maximum amount of memory, in MiB.
    """

    Min: int
    """
    The minimum amount of memory, in MiB.

    To specify no minimum limit, specify ``0``.
    """
    Max: int | None = None
    """
    The maximum amount of memory, in MiB.

    To specify no maximum limit, omit this parameter.
    """


class EC2MemoryGiBPerVCpuRequest(Boto3Model):
    """
    The minimum and maximum amount of memory per vCPU, in GiB.
    """

    Min: float | None = None
    """
    The minimum amount of memory per vCPU, in GiB.

    To specify no minimum limit, omit this parameter.
    """
    Max: float | None = None
    """
    The maximum amount of memory per vCPU, in GiB.

    To specify no maximum limit, omit this parameter.
    """


class NetworkInterfaceCountRequest(Boto3Model):
    """
    The minimum and maximum number of network interfaces.
    """

    Min: int | None = None
    """
    The minimum number of network interfaces.

    To specify no minimum limit, omit this parameter.
    """
    Max: int | None = None
    """
    The maximum number of network interfaces.

    To specify no maximum limit, omit this parameter.
    """


class TotalLocalStorageGBRequest(Boto3Model):
    """
    The minimum and maximum amount of total local storage, in GB.
    """

    Min: float | None = None
    """
    The minimum amount of total local storage, in GB.

    To specify no minimum limit, omit this parameter.
    """
    Max: float | None = None
    """
    The maximum amount of total local storage, in GB.

    To specify no maximum limit, omit this parameter.
    """


class BaselineEbsBandwidthMbpsRequest(Boto3Model):
    """
    The minimum and maximum baseline bandwidth to Amazon EBS, 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*.
    """

    Min: int | None = None
    """
    The minimum baseline bandwidth, in Mbps.

    To specify no minimum limit, omit this parameter.
    """
    Max: int | None = None
    """
    The maximum baseline bandwidth, in Mbps.

    To specify no maximum limit, omit this parameter.
    """


class AcceleratorCountRequest(Boto3Model):
    """
    The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services
    Inferentia chips) on an instance.

    To
    exclude accelerator-enabled instance types, set ``Max`` to ``0``.
    """

    Min: int | None = None
    """
    The minimum number of accelerators.

    To specify no minimum limit, omit this parameter.
    """
    Max: int | None = None
    """
    The maximum number of accelerators.

    To specify no maximum limit, omit this parameter. To exclude accelerator-enabled
    instance types, set ``Max`` to ``0``.
    """


class AcceleratorTotalMemoryMiBRequest(Boto3Model):
    """
    The minimum and maximum amount of total accelerator memory, in MiB.
    """

    Min: int | None = None
    """
    The minimum amount of accelerator memory, in MiB.

    To specify no minimum limit, omit this parameter.
    """
    Max: int | None = None
    """
    The maximum amount of accelerator memory, in MiB.

    To specify no maximum limit, omit this parameter.
    """


class EC2NetworkBandwidthGbpsRequest(Boto3Model):
    """
    The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps).

    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 Gbps.

    To specify no minimum limit, omit this parameter.
    """
    Max: float | None = None
    """
    The maximum amount of network bandwidth, in Gbps.

    To specify no maximum limit, omit this parameter.
    """


class PerformanceFactorReferenceRequest(Boto3Model):
    """
    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.

    Currently, only one instance family can be specified in the list.
    """

    InstanceFamily: str | None = None
    """
    The instance family to use as a baseline reference.
    """


class CpuPerformanceFactorRequest(Boto3Model):
    """
    The CPU performance to consider, using an instance family as the baseline reference.
    """

    References: List["PerformanceFactorReferenceRequest"] | None = None
    """
    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.
    """


class BaselinePerformanceFactorsRequest(Boto3Model):
    """
    The baseline performance to consider, using an instance family as a baseline
    reference. The instance family establishes the lowest acceptable level of
    performance. Amazon EC2 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`` would use the CPU performance of the ``c6i`` family as the baseline reference.
    """

    Cpu: CpuPerformanceFactorRequest | None = None
    """
    The CPU performance to consider, using an instance family as the baseline reference.
    """


class InstanceRequirementsRequest(Boto3Model):
    """
    The attributes for the instance types. When you specify instance attributes, Amazon
    EC2 will identify instance types with these attributes.

    You must specify ``VCpuCount`` and ``MemoryMiB``. All other attributes are optional. Any unspecified optional attribute
    is set to its default.

    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 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.

    If you specify ``InstanceRequirements``, you can't specify ``InstanceType``.

    Attribute-based instance type selection is only supported when using Auto Scaling groups, EC2 Fleet, and Spot Fleet to
    launch instances. If you plan to use the launch template in the `launch instance
    wizard <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-instance-wizard.html>`_, or with the
    `RunInstances <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html>`_ API or
    `AWS::EC2::Instance <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html>`_
    Amazon Web Services CloudFormation resource, you can't specify ``InstanceRequirements``.

    For more information, see `Specify attributes for instance type selection for EC2 Fleet or Spot
    Fleet <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-attribute-based-instance-type-selection.html>`_ and
    `Spot placement score <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-placement-score.html>`_ in the *Amazon EC2
    User Guide*.
    """

    VCpuCount: VCpuCountRangeRequest
    """
    The minimum and maximum number of vCPUs.
    """
    MemoryMiB: MemoryMiBRequest
    """
    The minimum and maximum amount of memory, in MiB.
    """
    CpuManufacturers: List[Literal["intel", "amd", "amazon-web-services", "apple"]] | None = None
    """
    The CPU manufacturers to include.
    """
    MemoryGiBPerVCpu: EC2MemoryGiBPerVCpuRequest | None = None
    """
    The minimum and maximum amount of memory per vCPU, in GiB.
    """
    ExcludedInstanceTypes: List[str] | None = None
    """
    The instance types to exclude.
    """
    InstanceGenerations: List[Literal["current", "previous"]] | None = None
    """
    Indicates whether current or previous generation instance types are included.

    The current generation instance types are recommended for use. Current generation
    instance types are typically the latest two to three generations in each instance
    family. For more information, see
    `Instance types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html>`_
    in the *Amazon EC2 User Guide*.
    """
    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 Spot 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 Spot price is
    from the lowest priced current generation instance types, and failing that, from the
    lowest priced previous generation instance types that match your attributes. When
    Amazon EC2 selects instance types with your attributes, it will exclude instance
    types whose Spot 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. When Amazon EC2 selects
    instance types with your attributes, it will exclude instance types whose price
    exceeds your specified threshold.
    """
    BareMetal: Literal["included", "required", "excluded"] | None = None
    """
    Indicates whether bare metal instance types must be included, excluded, or required.
    """
    BurstablePerformance: Literal["included", "required", "excluded"] | None = None
    """
    Indicates whether burstable performance T 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>`_.
    """
    RequireHibernateSupport: bool | None = None
    """
    Indicates whether instance types must support hibernation for On-Demand Instances.
    """
    NetworkInterfaceCount: NetworkInterfaceCountRequest | None = None
    """
    The minimum and maximum number of network interfaces.
    """
    LocalStorage: Literal["included", "required", "excluded"] | None = None
    """
    Indicates whether instance types with instance store volumes are included, excluded,
    or required.

    For more information,
    `Amazon EC2 instance store <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html>`_
    in the *Amazon EC2
    User Guide*.
    """
    LocalStorageTypes: List[Literal["hdd", "ssd"]] | None = None
    """
    The type of local storage that is required.
    """
    TotalLocalStorageGB: TotalLocalStorageGBRequest | None = None
    """
    The minimum and maximum amount of total local storage, in GB.
    """
    BaselineEbsBandwidthMbps: BaselineEbsBandwidthMbpsRequest | None = None
    """
    The minimum and maximum baseline bandwidth to Amazon EBS, 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: List[Literal["gpu", "fpga", "inference"]] | None = None
    """
    The accelerator types that must be on the instance type.
    """
    AcceleratorCount: AcceleratorCountRequest | None = None
    """
    The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services
    Inferentia chips) on an instance.
    """
    AcceleratorManufacturers: List[Literal["amazon-web-services", "amd", "nvidia", "xilinx", "habana"]] | None = None
    """
    Indicates whether instance types must have accelerators by specific manufacturers.
    """
    AcceleratorNames: List[Literal["a100", "inferentia", "k520", "k80", "m60", "radeon-pro-v520", "t4", "vu9p", "v100", "a10g", "h100", "t4g"]] | None = None
    """
    The accelerators that must be on the instance type.
    """
    AcceleratorTotalMemoryMiB: AcceleratorTotalMemoryMiBRequest | None = None
    """
    The minimum and maximum amount of total accelerator memory, in MiB.
    """
    NetworkBandwidthGbps: EC2NetworkBandwidthGbpsRequest | None = None
    """
    The minimum and maximum amount of baseline network bandwidth, in gigabits per second
    (Gbps).

    For more information, see
    `Amazon EC2 instance network bandwidth <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-network-
    bandwidth.html>`_ in the *Amazon EC2 User Guide*.
    """
    AllowedInstanceTypes: List[str] | None = None
    """
    The instance types to apply your specified attributes against.

    All other instance types are ignored, even if they match your specified attributes.
    """
    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 the
    lowest priced current generation instance types, and failing that, from the lowest
    priced previous generation instance types that match your attributes. When Amazon
    EC2 selects instance types with your attributes, it will exclude instance types
    whose price exceeds your specified threshold.
    """
    BaselinePerformanceFactors: BaselinePerformanceFactorsRequest | None = None
    """
    The baseline performance to consider, using an instance family as a baseline
    reference.

    The instance family establishes
    the lowest acceptable level of performance. Amazon EC2 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 more information, see `Performance
    protection <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-attribute-based-instance-type-
    selection.html#ec2fleet-abis-performance-protection>`_ in the *Amazon EC2 User Guide*.
    """


class LaunchTemplatePrivateDnsNameOptionsRequest(Boto3Model):
    """
    Describes the options for instance hostnames.
    """

    HostnameType: Literal["ip-name", "resource-name"] | None = None
    """
    The type of hostname for Amazon EC2 instances.

    For IPv4 only subnets, an instance DNS name must be based on the instance IPv4
    address. For IPv6 native subnets, an instance DNS name must be based on the instance
    ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4
    address or the instance ID.
    """
    EnableResourceNameDnsARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS A
    records.
    """
    EnableResourceNameDnsAAAARecord: bool | None = None
    """
    Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA
    records.
    """


class LaunchTemplateInstanceMaintenanceOptionsRequest(Boto3Model):
    """
    The maintenance options of your instance.
    """

    AutoRecovery: Literal["default", "disabled"] | None = None
    """
    Disables the automatic recovery behavior of your instance or sets it to default.

    For more information, see
    `Simplified automatic recovery <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-recover.html#instance-
    configuration-recovery>`_.
    """


class LaunchTemplateNetworkPerformanceOptionsRequest(Boto3Model):
    """
    When you configure network performance options in your launch template, your
    instance is geared for performance improvements based on the workload that it runs
    as soon as it's available.
    """

    BandwidthWeighting: Literal["default", "vpc-1", "ebs-1"] | None = None
    """
    Specify the bandwidth weighting option to boost the associated type of baseline
    bandwidth, as follows:
    """


class RequestLaunchTemplateData(Boto3Model):
    """
    The information to include in the launch template.

    You must specify at least one parameter for the launch template data.
    """

    KernelId: str | None = None
    """
    The ID of the kernel.
    """
    EbsOptimized: bool | None = None
    """
    Indicates whether the instance is optimized for Amazon EBS I/O.

    This optimization provides dedicated throughput to Amazon EBS and an optimized
    configuration stack to provide optimal Amazon EBS I/O performance. This optimization
    isn't available with all instance types. Additional usage charges apply when using
    an EBS-optimized instance.
    """
    IamInstanceProfile: LaunchTemplateIamInstanceProfileSpecificationRequest | None = None
    """
    The name or Amazon Resource Name (ARN) of an IAM instance profile.
    """
    BlockDeviceMappings: List["LaunchTemplateBlockDeviceMappingRequest"] | None = (
        None
    )
    """
    The block device mapping.
    """
    NetworkInterfaces: List["LaunchTemplateInstanceNetworkInterfaceSpecificationRequest"] | None = None
    """
    The network interfaces for the instance.
    """
    ImageId: str | None = None
    """
    The ID of the AMI in the format ``ami-0ac394d6a3example``.
    """
    InstanceType: Literal["a1.medium", "a1.large", "a1.xlarge", "a1.2xlarge", "a1.4xlarge", "a1.metal", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge", "c5.large", "c5.xlarge", "c5.2xlarge", "c5.4xlarge", "c5.9xlarge", "c5.12xlarge", "c5.18xlarge", "c5.24xlarge", "c5.metal", "c5a.large", "c5a.xlarge", "c5a.2xlarge", "c5a.4xlarge", "c5a.8xlarge", "c5a.12xlarge", "c5a.16xlarge", "c5a.24xlarge", "c5ad.large", "c5ad.xlarge", "c5ad.2xlarge", "c5ad.4xlarge", "c5ad.8xlarge", "c5ad.12xlarge", "c5ad.16xlarge", "c5ad.24xlarge", "c5d.large", "c5d.xlarge", "c5d.2xlarge", "c5d.4xlarge", "c5d.9xlarge", "c5d.12xlarge", "c5d.18xlarge", "c5d.24xlarge", "c5d.metal", "c5n.large", "c5n.xlarge", "c5n.2xlarge", "c5n.4xlarge", "c5n.9xlarge", "c5n.18xlarge", "c5n.metal", "c6g.medium", "c6g.large", "c6g.xlarge", "c6g.2xlarge", "c6g.4xlarge", "c6g.8xlarge", "c6g.12xlarge", "c6g.16xlarge", "c6g.metal", "c6gd.medium", "c6gd.large", "c6gd.xlarge", "c6gd.2xlarge", "c6gd.4xlarge", "c6gd.8xlarge", "c6gd.12xlarge", "c6gd.16xlarge", "c6gd.metal", "c6gn.medium", "c6gn.large", "c6gn.xlarge", "c6gn.2xlarge", "c6gn.4xlarge", "c6gn.8xlarge", "c6gn.12xlarge", "c6gn.16xlarge", "c6i.large", "c6i.xlarge", "c6i.2xlarge", "c6i.4xlarge", "c6i.8xlarge", "c6i.12xlarge", "c6i.16xlarge", "c6i.24xlarge", "c6i.32xlarge", "c6i.metal", "cc1.4xlarge", "cc2.8xlarge", "cg1.4xlarge", "cr1.8xlarge", "d2.xlarge", "d2.2xlarge", "d2.4xlarge", "d2.8xlarge", "d3.xlarge", "d3.2xlarge", "d3.4xlarge", "d3.8xlarge", "d3en.xlarge", "d3en.2xlarge", "d3en.4xlarge", "d3en.6xlarge", "d3en.8xlarge", "d3en.12xlarge", "dl1.24xlarge", "f1.2xlarge", "f1.4xlarge", "f1.16xlarge", "g2.2xlarge", "g2.8xlarge", "g3.4xlarge", "g3.8xlarge", "g3.16xlarge", "g3s.xlarge", "g4ad.xlarge", "g4ad.2xlarge", "g4ad.4xlarge", "g4ad.8xlarge", "g4ad.16xlarge", "g4dn.xlarge", "g4dn.2xlarge", "g4dn.4xlarge", "g4dn.8xlarge", "g4dn.12xlarge", "g4dn.16xlarge", "g4dn.metal", "g5.xlarge", "g5.2xlarge", "g5.4xlarge", "g5.8xlarge", "g5.12xlarge", "g5.16xlarge", "g5.24xlarge", "g5.48xlarge", "g5g.xlarge", "g5g.2xlarge", "g5g.4xlarge", "g5g.8xlarge", "g5g.16xlarge", "g5g.metal", "hi1.4xlarge", "hpc6a.48xlarge", "hs1.8xlarge", "h1.2xlarge", "h1.4xlarge", "h1.8xlarge", "h1.16xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "i3.large", "i3.xlarge", "i3.2xlarge", "i3.4xlarge", "i3.8xlarge", "i3.16xlarge", "i3.metal", "i3en.large", "i3en.xlarge", "i3en.2xlarge", "i3en.3xlarge", "i3en.6xlarge", "i3en.12xlarge", "i3en.24xlarge", "i3en.metal", "im4gn.large", "im4gn.xlarge", "im4gn.2xlarge", "im4gn.4xlarge", "im4gn.8xlarge", "im4gn.16xlarge", "inf1.xlarge", "inf1.2xlarge", "inf1.6xlarge", "inf1.24xlarge", "is4gen.medium", "is4gen.large", "is4gen.xlarge", "is4gen.2xlarge", "is4gen.4xlarge", "is4gen.8xlarge", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "m4.large", "m4.xlarge", "m4.2xlarge", "m4.4xlarge", "m4.10xlarge", "m4.16xlarge", "m5.large", "m5.xlarge", "m5.2xlarge", "m5.4xlarge", "m5.8xlarge", "m5.12xlarge", "m5.16xlarge", "m5.24xlarge", "m5.metal", "m5a.large", "m5a.xlarge", "m5a.2xlarge", "m5a.4xlarge", "m5a.8xlarge", "m5a.12xlarge", "m5a.16xlarge", "m5a.24xlarge", "m5ad.large", "m5ad.xlarge", "m5ad.2xlarge", "m5ad.4xlarge", "m5ad.8xlarge", "m5ad.12xlarge", "m5ad.16xlarge", "m5ad.24xlarge", "m5d.large", "m5d.xlarge", "m5d.2xlarge", "m5d.4xlarge", "m5d.8xlarge", "m5d.12xlarge", "m5d.16xlarge", "m5d.24xlarge", "m5d.metal", "m5dn.large", "m5dn.xlarge", "m5dn.2xlarge", "m5dn.4xlarge", "m5dn.8xlarge", "m5dn.12xlarge", "m5dn.16xlarge", "m5dn.24xlarge", "m5dn.metal", "m5n.large", "m5n.xlarge", "m5n.2xlarge", "m5n.4xlarge", "m5n.8xlarge", "m5n.12xlarge", "m5n.16xlarge", "m5n.24xlarge", "m5n.metal", "m5zn.large", "m5zn.xlarge", "m5zn.2xlarge", "m5zn.3xlarge", "m5zn.6xlarge", "m5zn.12xlarge", "m5zn.metal", "m6a.large", "m6a.xlarge", "m6a.2xlarge", "m6a.4xlarge", "m6a.8xlarge", "m6a.12xlarge", "m6a.16xlarge", "m6a.24xlarge", "m6a.32xlarge", "m6a.48xlarge", "m6g.metal", "m6g.medium", "m6g.large", "m6g.xlarge", "m6g.2xlarge", "m6g.4xlarge", "m6g.8xlarge", "m6g.12xlarge", "m6g.16xlarge", "m6gd.metal", "m6gd.medium", "m6gd.large", "m6gd.xlarge", "m6gd.2xlarge", "m6gd.4xlarge", "m6gd.8xlarge", "m6gd.12xlarge", "m6gd.16xlarge", "m6i.large", "m6i.xlarge", "m6i.2xlarge", "m6i.4xlarge", "m6i.8xlarge", "m6i.12xlarge", "m6i.16xlarge", "m6i.24xlarge", "m6i.32xlarge", "m6i.metal", "mac1.metal", "p2.xlarge", "p2.8xlarge", "p2.16xlarge", "p3.2xlarge", "p3.8xlarge", "p3.16xlarge", "p3dn.24xlarge", "p4d.24xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "r4.large", "r4.xlarge", "r4.2xlarge", "r4.4xlarge", "r4.8xlarge", "r4.16xlarge", "r5.large", "r5.xlarge", "r5.2xlarge", "r5.4xlarge", "r5.8xlarge", "r5.12xlarge", "r5.16xlarge", "r5.24xlarge", "r5.metal", "r5a.large", "r5a.xlarge", "r5a.2xlarge", "r5a.4xlarge", "r5a.8xlarge", "r5a.12xlarge", "r5a.16xlarge", "r5a.24xlarge", "r5ad.large", "r5ad.xlarge", "r5ad.2xlarge", "r5ad.4xlarge", "r5ad.8xlarge", "r5ad.12xlarge", "r5ad.16xlarge", "r5ad.24xlarge", "r5b.large", "r5b.xlarge", "r5b.2xlarge", "r5b.4xlarge", "r5b.8xlarge", "r5b.12xlarge", "r5b.16xlarge", "r5b.24xlarge", "r5b.metal", "r5d.large", "r5d.xlarge", "r5d.2xlarge", "r5d.4xlarge", "r5d.8xlarge", "r5d.12xlarge", "r5d.16xlarge", "r5d.24xlarge", "r5d.metal", "r5dn.large", "r5dn.xlarge", "r5dn.2xlarge", "r5dn.4xlarge", "r5dn.8xlarge", "r5dn.12xlarge", "r5dn.16xlarge", "r5dn.24xlarge", "r5dn.metal", "r5n.large", "r5n.xlarge", "r5n.2xlarge", "r5n.4xlarge", "r5n.8xlarge", "r5n.12xlarge", "r5n.16xlarge", "r5n.24xlarge", "r5n.metal", "r6g.medium", "r6g.large", "r6g.xlarge", "r6g.2xlarge", "r6g.4xlarge", "r6g.8xlarge", "r6g.12xlarge", "r6g.16xlarge", "r6g.metal", "r6gd.medium", "r6gd.large", "r6gd.xlarge", "r6gd.2xlarge", "r6gd.4xlarge", "r6gd.8xlarge", "r6gd.12xlarge", "r6gd.16xlarge", "r6gd.metal", "r6i.large", "r6i.xlarge", "r6i.2xlarge", "r6i.4xlarge", "r6i.8xlarge", "r6i.12xlarge", "r6i.16xlarge", "r6i.24xlarge", "r6i.32xlarge", "r6i.metal", "t1.micro", "t2.nano", "t2.micro", "t2.small", "t2.medium", "t2.large", "t2.xlarge", "t2.2xlarge", "t3.nano", "t3.micro", "t3.small", "t3.medium", "t3.large", "t3.xlarge", "t3.2xlarge", "t3a.nano", "t3a.micro", "t3a.small", "t3a.medium", "t3a.large", "t3a.xlarge", "t3a.2xlarge", "t4g.nano", "t4g.micro", "t4g.small", "t4g.medium", "t4g.large", "t4g.xlarge", "t4g.2xlarge", "u-6tb1.56xlarge", "u-6tb1.112xlarge", "u-9tb1.112xlarge", "u-12tb1.112xlarge", "u-6tb1.metal", "u-9tb1.metal", "u-12tb1.metal", "u-18tb1.metal", "u-24tb1.metal", "vt1.3xlarge", "vt1.6xlarge", "vt1.24xlarge", "x1.16xlarge", "x1.32xlarge", "x1e.xlarge", "x1e.2xlarge", "x1e.4xlarge", "x1e.8xlarge", "x1e.16xlarge", "x1e.32xlarge", "x2iezn.2xlarge", "x2iezn.4xlarge", "x2iezn.6xlarge", "x2iezn.8xlarge", "x2iezn.12xlarge", "x2iezn.metal", "x2gd.medium", "x2gd.large", "x2gd.xlarge", "x2gd.2xlarge", "x2gd.4xlarge", "x2gd.8xlarge", "x2gd.12xlarge", "x2gd.16xlarge", "x2gd.metal", "z1d.large", "z1d.xlarge", "z1d.2xlarge", "z1d.3xlarge", "z1d.6xlarge", "z1d.12xlarge", "z1d.metal", "x2idn.16xlarge", "x2idn.24xlarge", "x2idn.32xlarge", "x2iedn.xlarge", "x2iedn.2xlarge", "x2iedn.4xlarge", "x2iedn.8xlarge", "x2iedn.16xlarge", "x2iedn.24xlarge", "x2iedn.32xlarge", "c6a.large", "c6a.xlarge", "c6a.2xlarge", "c6a.4xlarge", "c6a.8xlarge", "c6a.12xlarge", "c6a.16xlarge", "c6a.24xlarge", "c6a.32xlarge", "c6a.48xlarge", "c6a.metal", "m6a.metal", "i4i.large", "i4i.xlarge", "i4i.2xlarge", "i4i.4xlarge", "i4i.8xlarge", "i4i.16xlarge", "i4i.32xlarge", "i4i.metal", "x2idn.metal", "x2iedn.metal", "c7g.medium", "c7g.large", "c7g.xlarge", "c7g.2xlarge", "c7g.4xlarge", "c7g.8xlarge", "c7g.12xlarge", "c7g.16xlarge", "mac2.metal", "c6id.large", "c6id.xlarge", "c6id.2xlarge", "c6id.4xlarge", "c6id.8xlarge", "c6id.12xlarge", "c6id.16xlarge", "c6id.24xlarge", "c6id.32xlarge", "c6id.metal", "m6id.large", "m6id.xlarge", "m6id.2xlarge", "m6id.4xlarge", "m6id.8xlarge", "m6id.12xlarge", "m6id.16xlarge", "m6id.24xlarge", "m6id.32xlarge", "m6id.metal", "r6id.large", "r6id.xlarge", "r6id.2xlarge", "r6id.4xlarge", "r6id.8xlarge", "r6id.12xlarge", "r6id.16xlarge", "r6id.24xlarge", "r6id.32xlarge", "r6id.metal", "r6a.large", "r6a.xlarge", "r6a.2xlarge", "r6a.4xlarge", "r6a.8xlarge", "r6a.12xlarge", "r6a.16xlarge", "r6a.24xlarge", "r6a.32xlarge", "r6a.48xlarge", "r6a.metal", "p4de.24xlarge", "u-3tb1.56xlarge", "u-18tb1.112xlarge", "u-24tb1.112xlarge", "trn1.2xlarge", "trn1.32xlarge", "hpc6id.32xlarge", "c6in.large", "c6in.xlarge", "c6in.2xlarge", "c6in.4xlarge", "c6in.8xlarge", "c6in.12xlarge", "c6in.16xlarge", "c6in.24xlarge", "c6in.32xlarge", "m6in.large", "m6in.xlarge", "m6in.2xlarge", "m6in.4xlarge", "m6in.8xlarge", "m6in.12xlarge", "m6in.16xlarge", "m6in.24xlarge", "m6in.32xlarge", "m6idn.large", "m6idn.xlarge", "m6idn.2xlarge", "m6idn.4xlarge", "m6idn.8xlarge", "m6idn.12xlarge", "m6idn.16xlarge", "m6idn.24xlarge", "m6idn.32xlarge", "r6in.large", "r6in.xlarge", "r6in.2xlarge", "r6in.4xlarge", "r6in.8xlarge", "r6in.12xlarge", "r6in.16xlarge", "r6in.24xlarge", "r6in.32xlarge", "r6idn.large", "r6idn.xlarge", "r6idn.2xlarge", "r6idn.4xlarge", "r6idn.8xlarge", "r6idn.12xlarge", "r6idn.16xlarge", "r6idn.24xlarge", "r6idn.32xlarge", "c7g.metal", "m7g.medium", "m7g.large", "m7g.xlarge", "m7g.2xlarge", "m7g.4xlarge", "m7g.8xlarge", "m7g.12xlarge", "m7g.16xlarge", "m7g.metal", "r7g.medium", "r7g.large", "r7g.xlarge", "r7g.2xlarge", "r7g.4xlarge", "r7g.8xlarge", "r7g.12xlarge", "r7g.16xlarge", "r7g.metal", "c6in.metal", "m6in.metal", "m6idn.metal", "r6in.metal", "r6idn.metal", "inf2.xlarge", "inf2.8xlarge", "inf2.24xlarge", "inf2.48xlarge", "trn1n.32xlarge", "i4g.large", "i4g.xlarge", "i4g.2xlarge", "i4g.4xlarge", "i4g.8xlarge", "i4g.16xlarge", "hpc7g.4xlarge", "hpc7g.8xlarge", "hpc7g.16xlarge", "c7gn.medium", "c7gn.large", "c7gn.xlarge", "c7gn.2xlarge", "c7gn.4xlarge", "c7gn.8xlarge", "c7gn.12xlarge", "c7gn.16xlarge", "p5.48xlarge", "m7i.large", "m7i.xlarge", "m7i.2xlarge", "m7i.4xlarge", "m7i.8xlarge", "m7i.12xlarge", "m7i.16xlarge", "m7i.24xlarge", "m7i.48xlarge", "m7i-flex.large", "m7i-flex.xlarge", "m7i-flex.2xlarge", "m7i-flex.4xlarge", "m7i-flex.8xlarge", "m7a.medium", "m7a.large", "m7a.xlarge", "m7a.2xlarge", "m7a.4xlarge", "m7a.8xlarge", "m7a.12xlarge", "m7a.16xlarge", "m7a.24xlarge", "m7a.32xlarge", "m7a.48xlarge", "m7a.metal-48xl", "hpc7a.12xlarge", "hpc7a.24xlarge", "hpc7a.48xlarge", "hpc7a.96xlarge", "c7gd.medium", "c7gd.large", "c7gd.xlarge", "c7gd.2xlarge", "c7gd.4xlarge", "c7gd.8xlarge", "c7gd.12xlarge", "c7gd.16xlarge", "m7gd.medium", "m7gd.large", "m7gd.xlarge", "m7gd.2xlarge", "m7gd.4xlarge", "m7gd.8xlarge", "m7gd.12xlarge", "m7gd.16xlarge", "r7gd.medium", "r7gd.large", "r7gd.xlarge", "r7gd.2xlarge", "r7gd.4xlarge", "r7gd.8xlarge", "r7gd.12xlarge", "r7gd.16xlarge", "r7a.medium", "r7a.large", "r7a.xlarge", "r7a.2xlarge", "r7a.4xlarge", "r7a.8xlarge", "r7a.12xlarge", "r7a.16xlarge", "r7a.24xlarge", "r7a.32xlarge", "r7a.48xlarge", "c7i.large", "c7i.xlarge", "c7i.2xlarge", "c7i.4xlarge", "c7i.8xlarge", "c7i.12xlarge", "c7i.16xlarge", "c7i.24xlarge", "c7i.48xlarge", "mac2-m2pro.metal", "r7iz.large", "r7iz.xlarge", "r7iz.2xlarge", "r7iz.4xlarge", "r7iz.8xlarge", "r7iz.12xlarge", "r7iz.16xlarge", "r7iz.32xlarge", "c7a.medium", "c7a.large", "c7a.xlarge", "c7a.2xlarge", "c7a.4xlarge", "c7a.8xlarge", "c7a.12xlarge", "c7a.16xlarge", "c7a.24xlarge", "c7a.32xlarge", "c7a.48xlarge", "c7a.metal-48xl", "r7a.metal-48xl", "r7i.large", "r7i.xlarge", "r7i.2xlarge", "r7i.4xlarge", "r7i.8xlarge", "r7i.12xlarge", "r7i.16xlarge", "r7i.24xlarge", "r7i.48xlarge", "dl2q.24xlarge", "mac2-m2.metal", "i4i.12xlarge", "i4i.24xlarge", "c7i.metal-24xl", "c7i.metal-48xl", "m7i.metal-24xl", "m7i.metal-48xl", "r7i.metal-24xl", "r7i.metal-48xl", "r7iz.metal-16xl", "r7iz.metal-32xl", "c7gd.metal", "m7gd.metal", "r7gd.metal", "g6.xlarge", "g6.2xlarge", "g6.4xlarge", "g6.8xlarge", "g6.12xlarge", "g6.16xlarge", "g6.24xlarge", "g6.48xlarge", "gr6.4xlarge", "gr6.8xlarge", "c7i-flex.large", "c7i-flex.xlarge", "c7i-flex.2xlarge", "c7i-flex.4xlarge", "c7i-flex.8xlarge", "u7i-12tb.224xlarge", "u7in-16tb.224xlarge", "u7in-24tb.224xlarge", "u7in-32tb.224xlarge", "u7ib-12tb.224xlarge", "c7gn.metal", "r8g.medium", "r8g.large", "r8g.xlarge", "r8g.2xlarge", "r8g.4xlarge", "r8g.8xlarge", "r8g.12xlarge", "r8g.16xlarge", "r8g.24xlarge", "r8g.48xlarge", "r8g.metal-24xl", "r8g.metal-48xl", "mac2-m1ultra.metal", "g6e.xlarge", "g6e.2xlarge", "g6e.4xlarge", "g6e.8xlarge", "g6e.12xlarge", "g6e.16xlarge", "g6e.24xlarge", "g6e.48xlarge", "c8g.medium", "c8g.large", "c8g.xlarge", "c8g.2xlarge", "c8g.4xlarge", "c8g.8xlarge", "c8g.12xlarge", "c8g.16xlarge", "c8g.24xlarge", "c8g.48xlarge", "c8g.metal-24xl", "c8g.metal-48xl", "m8g.medium", "m8g.large", "m8g.xlarge", "m8g.2xlarge", "m8g.4xlarge", "m8g.8xlarge", "m8g.12xlarge", "m8g.16xlarge", "m8g.24xlarge", "m8g.48xlarge", "m8g.metal-24xl", "m8g.metal-48xl", "x8g.medium", "x8g.large", "x8g.xlarge", "x8g.2xlarge", "x8g.4xlarge", "x8g.8xlarge", "x8g.12xlarge", "x8g.16xlarge", "x8g.24xlarge", "x8g.48xlarge", "x8g.metal-24xl", "x8g.metal-48xl", "i7ie.large", "i7ie.xlarge", "i7ie.2xlarge", "i7ie.3xlarge", "i7ie.6xlarge", "i7ie.12xlarge", "i7ie.18xlarge", "i7ie.24xlarge", "i7ie.48xlarge", "i8g.large", "i8g.xlarge", "i8g.2xlarge", "i8g.4xlarge", "i8g.8xlarge", "i8g.12xlarge", "i8g.16xlarge", "i8g.24xlarge", "i8g.metal-24xl", "u7i-6tb.112xlarge", "u7i-8tb.112xlarge", "u7inh-32tb.480xlarge", "p5e.48xlarge", "p5en.48xlarge", "f2.12xlarge", "f2.48xlarge", "trn2.48xlarge", "c7i-flex.12xlarge", "c7i-flex.16xlarge", "m7i-flex.12xlarge", "m7i-flex.16xlarge", "i7ie.metal-24xl", "i7ie.metal-48xl", "i8g.48xlarge", "c8gd.medium", "c8gd.large", "c8gd.xlarge", "c8gd.2xlarge", "c8gd.4xlarge", "c8gd.8xlarge", "c8gd.12xlarge", "c8gd.16xlarge", "c8gd.24xlarge", "c8gd.48xlarge", "c8gd.metal-24xl", "c8gd.metal-48xl", "i7i.large", "i7i.xlarge", "i7i.2xlarge", "i7i.4xlarge", "i7i.8xlarge", "i7i.12xlarge", "i7i.16xlarge", "i7i.24xlarge", "i7i.48xlarge", "i7i.metal-24xl", "i7i.metal-48xl", "p6-b200.48xlarge", "m8gd.medium", "m8gd.large", "m8gd.xlarge", "m8gd.2xlarge", "m8gd.4xlarge", "m8gd.8xlarge", "m8gd.12xlarge", "m8gd.16xlarge", "m8gd.24xlarge", "m8gd.48xlarge", "m8gd.metal-24xl", "m8gd.metal-48xl", "r8gd.medium", "r8gd.large", "r8gd.xlarge", "r8gd.2xlarge", "r8gd.4xlarge", "r8gd.8xlarge", "r8gd.12xlarge", "r8gd.16xlarge", "r8gd.24xlarge", "r8gd.48xlarge", "r8gd.metal-24xl", "r8gd.metal-48xl", "c8gn.medium", "c8gn.large", "c8gn.xlarge", "c8gn.2xlarge", "c8gn.4xlarge", "c8gn.8xlarge", "c8gn.12xlarge", "c8gn.16xlarge", "c8gn.24xlarge", "c8gn.48xlarge", "c8gn.metal-24xl", "c8gn.metal-48xl", "f2.6xlarge", "p6e-gb200.36xlarge", "g6f.large", "g6f.xlarge", "g6f.2xlarge", "g6f.4xlarge", "gr6f.4xlarge", "p5.4xlarge", "r8i.large", "r8i.xlarge", "r8i.2xlarge", "r8i.4xlarge", "r8i.8xlarge", "r8i.12xlarge", "r8i.16xlarge", "r8i.24xlarge", "r8i.32xlarge", "r8i.48xlarge", "r8i.96xlarge", "r8i.metal-48xl", "r8i.metal-96xl", "r8i-flex.large", "r8i-flex.xlarge", "r8i-flex.2xlarge", "r8i-flex.4xlarge", "r8i-flex.8xlarge", "r8i-flex.12xlarge", "r8i-flex.16xlarge", "m8i.large", "m8i.xlarge", "m8i.2xlarge", "m8i.4xlarge", "m8i.8xlarge", "m8i.12xlarge", "m8i.16xlarge", "m8i.24xlarge", "m8i.32xlarge", "m8i.48xlarge", "m8i.96xlarge", "m8i.metal-48xl", "m8i.metal-96xl", "m8i-flex.large", "m8i-flex.xlarge", "m8i-flex.2xlarge", "m8i-flex.4xlarge", "m8i-flex.8xlarge", "m8i-flex.12xlarge", "m8i-flex.16xlarge", "i8ge.large", "i8ge.xlarge", "i8ge.2xlarge", "i8ge.3xlarge", "i8ge.6xlarge", "i8ge.12xlarge", "i8ge.18xlarge", "i8ge.24xlarge", "i8ge.48xlarge", "i8ge.metal-24xl", "i8ge.metal-48xl", "mac-m4.metal", "mac-m4pro.metal", "r8gn.medium", "r8gn.large", "r8gn.xlarge", "r8gn.2xlarge", "r8gn.4xlarge", "r8gn.8xlarge", "r8gn.12xlarge", "r8gn.16xlarge", "r8gn.24xlarge", "r8gn.48xlarge", "r8gn.metal-24xl", "r8gn.metal-48xl"] | None = None
    """
    The instance type.

    For more information, see
    `Amazon EC2 instance types <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html>`_
    in the *Amazon EC2 User Guide*.
    """
    KeyName: str | None = None
    """
    The name of the key pair.

    You can create a key pair using
    `CreateKeyPair <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html>`_
    or
    `ImportKeyPair <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html>`_.
    """
    Monitoring: LaunchTemplatesMonitoringRequest | None = None
    """
    The monitoring for the instance.
    """
    Placement: LaunchTemplatePlacementRequest | None = None
    """
    The placement for the instance.
    """
    RamDiskId: str | None = None
    """
    The ID of the RAM disk.
    """
    DisableApiTermination: bool | None = None
    """
    Indicates whether termination protection is enabled for the instance.

    The default is ``false``, which means that you can
    terminate the instance using the Amazon EC2 console, command line tools, or API. You can enable termination protection
    when you launch an instance, while the instance is running, or while the instance is stopped.
    """
    InstanceInitiatedShutdownBehavior: Literal["stop", "terminate"] | None = None
    """
    Indicates whether an instance stops or terminates when you initiate shutdown from
    the instance (using the operating system command for system shutdown).
    """
    UserData: str | None = None
    """
    The user data to make available to the instance.

    You must provide base64-encoded text. User data is limited to 16 KB. For more
    information, see
    `Run commands when you launch an EC2 instance with user data input <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html>`_
    in the *Amazon EC2 User Guide*.
    """
    TagSpecifications: List["LaunchTemplateTagSpecificationRequest"] | None = None
    """
    The tags to apply to the resources that are created during instance launch.

    These tags are not applied to the launch template.
    """
    ElasticGpuSpecifications: List["ElasticGpuSpecification"] | None = None
    """
    Deprecated.
    """
    ElasticInferenceAccelerators: List["LaunchTemplateElasticInferenceAccelerator"] | None = None
    """
    Amazon Elastic Inference is no longer available.
    """
    SecurityGroupIds: List[str] | None = None
    """
    The IDs of the security groups.
    """
    SecurityGroups: List[str] | None = None
    """
    The names of the security groups.

    For a nondefault VPC, you must use security group IDs instead.
    """
    InstanceMarketOptions: LaunchTemplateInstanceMarketOptionsRequest | None = None
    """
    The market (purchasing) option for the instances.
    """
    CreditSpecification: CreditSpecificationRequest | None = None
    """
    The credit option for CPU usage of the instance.

    Valid only for T instances.
    """
    CpuOptions: LaunchTemplateCpuOptionsRequest | None = None
    """
    The CPU options for the instance.

    For more information, see
    `CPU options for Amazon EC2 instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html>`_
    in the *Amazon EC2 User
    Guide*.
    """
    CapacityReservationSpecification: LaunchTemplateCapacityReservationSpecificationRequest | None = None
    """
    The Capacity Reservation targeting option.

    If you do not specify this parameter, the instance's Capacity Reservation
    preference defaults to ``open``, which enables it to run in any open Capacity Reservation that has matching attributes
    (instance type, platform, Availability Zone).
    """
    LicenseSpecifications: List["LaunchTemplateLicenseConfigurationRequest"] | None = None
    """
    The license configurations.
    """
    HibernationOptions: LaunchTemplateHibernationOptionsRequest | None = None
    """
    Indicates whether an instance is enabled for hibernation.

    This parameter is valid only if the instance meets the
    `hibernation prerequisites <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html>`_.
    For    more information, see
    `Hibernate your Amazon EC2 instance <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html>`_
    in the *Amazon EC2 User Guide*.
    """
    MetadataOptions: LaunchTemplateInstanceMetadataOptionsRequest | None = None
    """
    The metadata options for the instance.

    For more information, see
    `Configure the Instance Metadata Service options <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html>`_
    in the *Amazon
    EC2 User Guide*.
    """
    EnclaveOptions: LaunchTemplateEnclaveOptionsRequest | None = None
    """
    Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.

    For more information, see
    `What is Nitro Enclaves? <https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html>`_
    in the *Amazon Web Services Nitro
    Enclaves User Guide*.
    """
    InstanceRequirements: InstanceRequirementsRequest | None = None
    """
    The attributes for the instance types.

    When you specify instance attributes, Amazon EC2 will identify instance types with
    these attributes.
    """
    PrivateDnsNameOptions: LaunchTemplatePrivateDnsNameOptionsRequest | None = None
    """
    The options for the instance hostname.

    The default values are inherited from the subnet.
    """
    MaintenanceOptions: LaunchTemplateInstanceMaintenanceOptionsRequest | None = None
    """
    The maintenance options for the instance.
    """
    DisableApiStop: bool | None = None
    """
    Indicates whether to enable the instance for stop protection.

    For more information, see
    `Enable stop protection for your EC2 instances <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-stop-protection.html>`_
    in the *Amazon EC2 User
    Guide*.
    """
    Operator: OperatorRequest | None = None
    """
    The entity that manages the launch template.
    """
    NetworkPerformanceOptions: LaunchTemplateNetworkPerformanceOptionsRequest | None = None
    """
    Contains launch template settings to boost network performance for the type of
    workload that runs on your instance.
    """


class ValidationError(Boto3Model):
    """
    The error code and error message that is returned for a parameter or parameter
    combination that is not valid when a new launch template or new version of a launch
    template is created.
    """

    Code: str | None = None
    """
    The error code that indicates why the parameter or parameter combination is not
    valid.

    For more information about error codes, see
    `Error codes <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html>`_.
    """
    Message: str | None = None
    """
    The error message that describes why the parameter or parameter combination is not
    valid.

    For more information about error messages, see
    `Error codes <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html>`_.
    """


class ValidationWarning(Boto3Model):
    """
    The error codes and error messages that are returned for the parameters or parameter
    combinations that are not valid when a new launch template or new version of a
    launch template is created.
    """

    Errors: List["ValidationError"] | None = None
    """
    The error codes and error messages.
    """


class CreateLaunchTemplateResult(Boto3Model):
    LaunchTemplateInstance: LaunchTemplate = Field(default=None, alias="LaunchTemplate")
    """
    Information about the launch template.
    """
    Warning: ValidationWarning | None = None
    """
    If the launch template contains parameters or parameter combinations that are not
    valid, an error code and an error message are returned for each issue that's found.
    """


class DeleteLaunchTemplateResult(Boto3Model):
    LaunchTemplateInstance: LaunchTemplate = Field(default=None, alias="LaunchTemplate")
    """
    Information about the launch template.
    """


class DescribeLaunchTemplatesResult(Boto3Model):
    LaunchTemplates: List["LaunchTemplate"] | None = None
    """
    Information about the launch templates.
    """
    NextToken: str | None = None
    """
    The token to use to retrieve the next page of results.

    This value is ``null`` when there are no more results to return.
    """


class CreateLaunchTemplateVersionResult(Boto3Model):
    LaunchTemplateVersionInstance: LaunchTemplateVersion = Field(
        default=None, alias="LaunchTemplateVersion"
    )
    """
    Information about the launch template version.
    """
    Warning: ValidationWarning | None = None
    """
    If the new version of the launch template contains parameters or parameter
    combinations that are not valid, an error code and an error message are returned for
    each issue that's found.
    """


class DeleteLaunchTemplateVersionsResponseSuccessItem(Boto3Model):
    """
    Describes a launch template version that was successfully deleted.
    """

    LaunchTemplateId: str | None = None
    """
    The ID of the launch template.
    """
    LaunchTemplateName: str | None = None
    """
    The name of the launch template.
    """
    VersionNumber: int | None = None
    """
    The version number of the launch template.
    """


class EC2ResponseError(Boto3Model):
    """
    Describes the error that's returned when you cannot delete a launch template
    version.
    """

    Code: Literal["launchTemplateIdDoesNotExist", "launchTemplateIdMalformed", "launchTemplateNameDoesNotExist", "launchTemplateNameMalformed", "launchTemplateVersionDoesNotExist", "unexpectedError"] | None = None
    """
    The error code.
    """
    Message: str | None = None
    """
    The error message, if applicable.
    """


class DeleteLaunchTemplateVersionsResponseErrorItem(Boto3Model):
    """
    Describes a launch template version that could not be deleted.
    """

    LaunchTemplateId: str | None = None
    """
    The ID of the launch template.
    """
    LaunchTemplateName: str | None = None
    """
    The name of the launch template.
    """
    VersionNumber: int | None = None
    """
    The version number of the launch template.
    """
    ResponseError: EC2ResponseError | None = None
    """
    Information about the error.
    """


class DeleteLaunchTemplateVersionsResult(Boto3Model):
    SuccessfullyDeletedLaunchTemplateVersions: List["DeleteLaunchTemplateVersionsResponseSuccessItem"] | None = None
    """
    Information about the launch template versions that were successfully deleted.
    """
    UnsuccessfullyDeletedLaunchTemplateVersions: List["DeleteLaunchTemplateVersionsResponseErrorItem"] | None = None
    """
    Information about the launch template versions that could not be deleted.
    """


class DescribeLaunchTemplateVersionsResult(Boto3Model):
    LaunchTemplateVersions: List["LaunchTemplateVersion"] | None = None
    """
    Information about the launch template versions.
    """
    NextToken: str | None = None
    """
    The token to use to retrieve the next page of results.

    This value is ``null`` when there are no more results to return.
    """


class CreateNetworkInterfaceResult(Boto3Model):
    NetworkInterfaceInstance: NetworkInterface = Field(
        default=None, alias="NetworkInterface"
    )
    """
    Information about the network interface.
    """
    ClientToken: str | None = None
    """
    The token to use to retrieve the next page of results.

    This value is ``null`` when there are no more results to return.
    """


class DescribeNetworkInterfacesResult(Boto3Model):
    NetworkInterfaces: List["NetworkInterface"] | None = None
    """
    Information about the network interfaces.
    """
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """


class AttachNetworkInterfaceResult(Boto3Model):
    """
    Contains the output of AttachNetworkInterface.
    """

    AttachmentId: str | None = None
    """
    The ID of the network interface attachment.
    """
    NetworkCardIndex: int | None = None
    """
    The index of the network card.
    """


class NetworkInterfacePermissionState(Boto3Model):
    """
    Describes the state of a network interface permission.
    """

    State: Literal["pending", "granted", "revoking", "revoked"] | None = None
    """
    The state of the permission.
    """
    StatusMessage: str | None = None
    """
    A status message, if applicable.
    """


class NetworkInterfacePermission(Boto3Model):
    """
    Describes a permission for a network interface.
    """

    NetworkInterfacePermissionId: str | None = None
    """
    The ID of the network interface permission.
    """
    NetworkInterfaceId: str | None = None
    """
    The ID of the network interface.
    """
    AwsAccountId: str | None = None
    """
    The Amazon Web Services account ID.
    """
    AwsService: str | None = None
    """
    The Amazon Web Services service.
    """
    Permission: Literal["INSTANCE-ATTACH", "EIP-ASSOCIATE"] | None = None
    """
    The type of permission.
    """
    PermissionState: NetworkInterfacePermissionState | None = None
    """
    Information about the state of the permission.
    """


class DescribeNetworkInterfacePermissionsResult(Boto3Model):
    """
    Contains the output for DescribeNetworkInterfacePermissions.
    """

    NetworkInterfacePermissions: List["NetworkInterfacePermission"] | None = None
    """
    The network interface permissions.
    """
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """


class DescribeInstanceTypesResult(Boto3Model):
    InstanceTypes: List["EC2InstanceType"] | None = None
    """
    The instance type.
    """
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """


class DescribeSnapshotsResult(Boto3Model):
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """
    Snapshots: List["Snapshot"] | None = None
    """
    Information about the snapshots.
    """


class EnableSnapshotBlockPublicAccessResult(Boto3Model):
    State: Literal["block-all-sharing", "block-new-sharing", "unblocked"] | None = (
        None
    )
    """
    The state of block public access for snapshots for the account and Region.

    Returns either ``block-all-sharing`` or
    ``block-new-sharing`` if the request succeeds.
    """


class DisableSnapshotBlockPublicAccessResult(Boto3Model):
    State: Literal["block-all-sharing", "block-new-sharing", "unblocked"] | None = (
        None
    )
    """
    Returns ``unblocked`` if the request succeeds.
    """


class GetSnapshotBlockPublicAccessStateResult(Boto3Model):
    State: Literal["block-all-sharing", "block-new-sharing", "unblocked"] | None = (
        None
    )
    """
    The current state of block public access for snapshots.

    Possible values include:
    """
    ManagedBy: Literal["account", "declarative-policy"] | None = None
    """
    The entity that manages the state for block public access for snapshots.

    Possible values include:
    """


class LockSnapshotResult(Boto3Model):
    SnapshotId: str | None = None
    """
    The ID of the snapshot.
    """
    LockState: Literal["compliance", "governance", "compliance-cooloff", "expired"] | None = None
    """
    The state of the snapshot lock.

    Valid states include:
    """
    LockDuration: int | None = None
    """
    The period of time for which the snapshot is locked, in days.
    """
    CoolOffPeriod: int | None = None
    """
    The compliance mode cooling-off period, in hours.
    """
    CoolOffPeriodExpiresOn: datetime | None = None
    """
    The date and time at which the compliance mode cooling-off period expires, in the
    UTC time zone (``YYYY-MM- DDThh:mm:ss.sssZ``).
    """
    LockCreatedOn: datetime | None = None
    """
    The date and time at which the snapshot was locked, in the UTC time zone (``YYYY-MM-
    DDThh:mm:ss.sssZ``).
    """
    LockExpiresOn: datetime | None = None
    """
    The date and time at which the lock will expire, in the UTC time zone (``YYYY-MM-
    DDThh:mm:ss.sssZ``).
    """
    LockDurationStartTime: datetime | None = None
    """
    The date and time at which the lock duration started, in the UTC time zone (``YYYY-
    MM-DDThh:mm:ss.sssZ``).
    """


class LockedSnapshotsInfo(Boto3Model):
    """
    Information about a locked snapshot.
    """

    OwnerId: str | None = None
    """
    The account ID of the Amazon Web Services account that owns the snapshot.
    """
    SnapshotId: str | None = None
    """
    The ID of the snapshot.
    """
    LockState: Literal["compliance", "governance", "compliance-cooloff", "expired"] | None = None
    """
    The state of the snapshot lock.

    Valid states include:
    """
    LockDuration: int | None = None
    """
    The period of time for which the snapshot is locked, in days.
    """
    CoolOffPeriod: int | None = None
    """
    The compliance mode cooling-off period, in hours.
    """
    CoolOffPeriodExpiresOn: datetime | None = None
    """
    The date and time at which the compliance mode cooling-off period expires, in the
    UTC time zone (``YYYY-MM- DDThh:mm:ss.sssZ``).
    """
    LockCreatedOn: datetime | None = None
    """
    The date and time at which the snapshot was locked, in the UTC time zone (``YYYY-MM-
    DDThh:mm:ss.sssZ``).
    """
    LockDurationStartTime: datetime | None = None
    """
    The date and time at which the lock duration started, in the UTC time zone (``YYYY-
    MM-DDThh:mm:ss.sssZ``).
    """
    LockExpiresOn: datetime | None = None
    """
    The date and time at which the lock will expire, in the UTC time zone (``YYYY-MM-
    DDThh:mm:ss.sssZ``).
    """


class DescribeLockedSnapshotsResult(Boto3Model):
    Snapshots: List["LockedSnapshotsInfo"] | None = None
    """
    Information about the snapshots.
    """
    NextToken: str | None = None
    """
    The token to include in another request to get the next page of items.

    This value is ``null`` when there are no more
    items to return.
    """


class UnlockSnapshotResult(Boto3Model):
    SnapshotId: str | None = None
    """
    The ID of the snapshot.
    """


class CopySnapshotResult(TagsDictMixin, Boto3Model):
    tag_class: ClassVar[Type] = Tag
    Tags: List[Tag] | None = None
    """
    Any tags applied to the new snapshot.
    """
    SnapshotId: str | None = None
    """
    The ID of the new snapshot.
    """
