Frage

I have a pretty standard stack, RDS, 2 EC2 instances using ELB. Because I wanted the ELB to be restricted to a particular IP range I've launched the stack in VPC, for DR reasons across 2 subnets.

I use several ephemeral ec2 machines, which when not in VPC I allowed to startup in any availability zone. Which (as far as I understand) would mean that if an AZ were unavailable then machines would be started in other zones.

Is there a way to emulate this in VPC? Is there a way of saying launch a machine in any subnet in a VPC?

If not its fairly easy to workaround by picking a subnet at random, and if it fails trying another. Just wondered if there was a supported method that's cleaner?

I'm using python and boto.

thanks

War es hilfreich?

Lösung

Which (as far as I understand) would mean that if an AZ were unavailable then machines would be started in other zones.

That's correct and it would indeed be nice to have this option available within an Amazon VPC as well when running instances directly via the available Amazon EC2 API actions.

Unfortunately both the RunInstances and the RequestSpotInstances API actions only allow to specify the optional parameters SubnetId or LaunchSpecification.SubnetId respectively (The ID of the subnet in which to launch the [Spot] Instance), thus won't have any information into which VPC you would want to launch the instance if no subnet is specified.

Workaround

You can achieve the desired behavior indirectly via Auto Scaling by means of its CreateAutoScalingGroup API action, see parameter VPCZoneIdentifier:

A comma-separated list of subnet identifiers of Amazon Virtual Private Clouds (Amazon VPCs).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top