DocsAWS 101BlogServices

EC2

Instances, VPCs, subnets, security groups, EBS volumes, snapshots, launch templates, key pairs, elastic IPs — and RegisterImage to boot an instance as a real container (opt-in).

Query (form-encoded) multi-tenant 157 operations

Quick start

import boto3
ec2 = boto3.client("ec2", endpoint_url="http://localhost:4566",
                   region_name="us-east-1",
                   aws_access_key_id="test", aws_secret_access_key="test")
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")["Vpc"]
print(ec2.describe_vpcs()["Vpcs"])

Supported operations

157 operations exposed by this service as of MiniStack 1.5.8. Extracted directly from the handler dispatch in the source module.

AcceptVpcPeeringConnection AllocateAddress AssociateAddress AssociateDhcpOptions AssociateIamInstanceProfile AssociateRouteTable AttachInternetGateway AttachNetworkInterface AttachVolume AttachVpnGateway AuthorizeSecurityGroupEgress AuthorizeSecurityGroupIngress CopySnapshot CreateCustomerGateway CreateDefaultVpc CreateDhcpOptions CreateEgressOnlyInternetGateway CreateFleet CreateFlowLogs CreateInternetGateway CreateKeyPair CreateLaunchTemplate CreateLaunchTemplateVersion CreateManagedPrefixList CreateNatGateway CreateNetworkAcl CreateNetworkAclEntry CreateNetworkInterface CreatePlacementGroup CreateRoute CreateRouteTable CreateSecurityGroup CreateSnapshot CreateSubnet CreateTags CreateVolume CreateVpc CreateVpcEndpoint CreateVpcPeeringConnection CreateVpnConnection CreateVpnConnectionRoute CreateVpnGateway DeleteCustomerGateway DeleteDhcpOptions DeleteEgressOnlyInternetGateway DeleteFlowLogs DeleteInternetGateway DeleteKeyPair DeleteLaunchTemplate DeleteManagedPrefixList DeleteNatGateway DeleteNetworkAcl DeleteNetworkAclEntry DeleteNetworkInterface DeletePlacementGroup DeleteRoute DeleteRouteTable DeleteSecurityGroup DeleteSnapshot DeleteSubnet DeleteTags DeleteVolume DeleteVpc DeleteVpcEndpoints DeleteVpcPeeringConnection DeleteVpnConnection DeleteVpnConnectionRoute DeleteVpnGateway DeregisterImage DescribeAddresses DescribeAddressesAttribute DescribeAvailabilityZones DescribeCapacityReservations DescribeCustomerGateways DescribeDhcpOptions DescribeEgressOnlyInternetGateways DescribeFleets DescribeFlowLogs DescribeIamInstanceProfileAssociations DescribeImageAttribute DescribeImages DescribeInstanceAttribute DescribeInstanceCreditSpecifications DescribeInstances DescribeInstanceStatus DescribeInstanceTopology DescribeInstanceTypes DescribeInternetGateways DescribeKeyPairs DescribeLaunchTemplates DescribeLaunchTemplateVersions DescribeManagedPrefixLists DescribeNatGateways DescribeNetworkAcls DescribeNetworkInterfaces DescribePlacementGroups DescribePrefixLists DescribeRegions DescribeRouteTables DescribeSecurityGroupRules DescribeSecurityGroups DescribeSnapshotAttribute DescribeSnapshots DescribeSpotInstanceRequests DescribeSubnets DescribeTags DescribeVolumeAttribute DescribeVolumes DescribeVolumesModifications DescribeVolumeStatus DescribeVpcAttribute DescribeVpcClassicLink DescribeVpcClassicLinkDnsSupport DescribeVpcEndpoints DescribeVpcEndpointServices DescribeVpcPeeringConnections DescribeVpcs DescribeVpnConnections DescribeVpnGateways DetachInternetGateway DetachNetworkInterface DetachVolume DetachVpnGateway DisableVgwRoutePropagation DisassociateAddress DisassociateIamInstanceProfile DisassociateRouteTable EnableVgwRoutePropagation EnableVolumeIO GetManagedPrefixListEntries ImportKeyPair ModifyImageAttribute ModifyInstanceMaintenanceOptions ModifyLaunchTemplate ModifyManagedPrefixList ModifySecurityGroupRules ModifySnapshotAttribute ModifySubnetAttribute ModifyVolume ModifyVolumeAttribute ModifyVpcAttribute ModifyVpcEndpoint RebootInstances RegisterImage ReleaseAddress ReplaceIamInstanceProfileAssociation ReplaceNetworkAclAssociation ReplaceNetworkAclEntry ReplaceRoute ReplaceRouteTableAssociation ResetImageAttribute RevokeSecurityGroupEgress RevokeSecurityGroupIngress RunInstances StartInstances StopInstances TerminateInstances

CloudFormation

The CloudFormation engine provisions these resource types via this service:

AWS::EC2::InternetGateway AWS::EC2::LaunchTemplate AWS::EC2::Route AWS::EC2::RouteTable AWS::EC2::SecurityGroup AWS::EC2::Subnet AWS::EC2::SubnetRouteTableAssociation AWS::EC2::VPC AWS::EC2::VPCEndpoint AWS::EC2::VPCGatewayAttachment

See CloudFormation engine for intrinsic support and lifecycle details.

Known limitations

  • RunInstances returns instance metadata only by default (no real VM). Since 1.5.0, RegisterImage can back an instance with a real container (opt-in) so it is reachable and ssm:SendCommand runs on it.
  • Getting into a registered-AMI instance: key pairs are metadata only — nothing installs them, so ssh-copy-id cannot work. Use an image that runs sshd with your public key baked in, or mount one with EC2_DOCKER_FLAGS (-v /path/authorized_keys:/root/.ssh/authorized_keys:ro); on Mac/Windows publish the port instead (-p 2222:22) and ssh to localhost. Public and private IP both report the container's Docker-network IP. No SSH at all? ssm send-command with AWS-RunShellScript runs inside the instance container.
  • No networking — security group rules are stored but never filter traffic.
  • IAM permission evaluation on ec2:* is off by default; set AUTH=true to enable it.

Source

  • ministack/services/ec2.py

Read the source to verify the ops list above — dispatch tables and handler functions are the ground truth.