Merge pull request #2319 from acsbendi/autoscaling-group-from-instance
Implemented creating Auto Scaling group from instance
This commit is contained in:
commit
7ec3d43e0c
6 changed files with 126 additions and 8 deletions
|
|
@ -424,10 +424,10 @@ class Instance(TaggedEC2Resource, BotoInstance):
|
|||
self.instance_initiated_shutdown_behavior = kwargs.get("instance_initiated_shutdown_behavior", "stop")
|
||||
self.sriov_net_support = "simple"
|
||||
self._spot_fleet_id = kwargs.get("spot_fleet_id", None)
|
||||
associate_public_ip = kwargs.get("associate_public_ip", False)
|
||||
self.associate_public_ip = kwargs.get("associate_public_ip", False)
|
||||
if in_ec2_classic:
|
||||
# If we are in EC2-Classic, autoassign a public IP
|
||||
associate_public_ip = True
|
||||
self.associate_public_ip = True
|
||||
|
||||
amis = self.ec2_backend.describe_images(filters={'image-id': image_id})
|
||||
ami = amis[0] if amis else None
|
||||
|
|
@ -458,9 +458,9 @@ class Instance(TaggedEC2Resource, BotoInstance):
|
|||
self.vpc_id = subnet.vpc_id
|
||||
self._placement.zone = subnet.availability_zone
|
||||
|
||||
if associate_public_ip is None:
|
||||
if self.associate_public_ip is None:
|
||||
# Mapping public ip hasnt been explicitly enabled or disabled
|
||||
associate_public_ip = subnet.map_public_ip_on_launch == 'true'
|
||||
self.associate_public_ip = subnet.map_public_ip_on_launch == 'true'
|
||||
elif placement:
|
||||
self._placement.zone = placement
|
||||
else:
|
||||
|
|
@ -472,7 +472,7 @@ class Instance(TaggedEC2Resource, BotoInstance):
|
|||
self.prep_nics(
|
||||
kwargs.get("nics", {}),
|
||||
private_ip=kwargs.get("private_ip"),
|
||||
associate_public_ip=associate_public_ip
|
||||
associate_public_ip=self.associate_public_ip
|
||||
)
|
||||
|
||||
def __del__(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue