Skip to content

Commit

Permalink
Merge pull request #1799 from anarcher/develop
Browse files Browse the repository at this point in the history
Added launch_config's parameter associate_ip_address for VPC. Fixes #1799.
  • Loading branch information
danielgtaylor committed Oct 22, 2013
2 parents 7e6f98d + 24db755 commit 6685adb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions boto/ec2/autoscale/__init__.py
Expand Up @@ -241,6 +241,10 @@ def create_launch_configuration(self, launch_config):
params['EbsOptimized'] = 'true'
else:
params['EbsOptimized'] = 'false'
if launch_config.associate_public_ip_address is True:
params['AssociatePublicIpAddress'] = 'true'
elif launch_config.associate_public_ip_address is False:
params['AssociatePublicIpAddress'] = 'false'
return self.get_object('CreateLaunchConfiguration', params,
Request, verb='POST')

Expand Down
8 changes: 7 additions & 1 deletion boto/ec2/autoscale/launchconfig.py
Expand Up @@ -94,7 +94,8 @@ def __init__(self, connection=None, name=None, image_id=None,
instance_type='m1.small', kernel_id=None,
ramdisk_id=None, block_device_mappings=None,
instance_monitoring=False, spot_price=None,
instance_profile_name=None, ebs_optimized=False):
instance_profile_name=None, ebs_optimized=False,
associate_public_ip_address=None):
"""
A launch configuration.
Expand Down Expand Up @@ -144,6 +145,10 @@ def __init__(self, connection=None, name=None, image_id=None,
:type ebs_optimized: bool
:param ebs_optimized: Specifies whether the instance is optimized
for EBS I/O (true) or not (false).
:type associate_public_ip_address: bool
:param associate_public_ip_address: Used for Auto Scaling groups that launch instances into an Amazon Virtual Private Cloud.
Specifies whether to assign a public IP address to each instance launched in a Amazon VPC.
"""
self.connection = connection
self.name = name
Expand All @@ -163,6 +168,7 @@ def __init__(self, connection=None, name=None, image_id=None,
self.instance_profile_name = instance_profile_name
self.launch_configuration_arn = None
self.ebs_optimized = ebs_optimized
self.associate_public_ip_address = associate_public_ip_address

def __repr__(self):
return 'LaunchConfiguration:%s' % self.name
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/ec2/autoscale/test_group.py
Expand Up @@ -227,7 +227,8 @@ def test_launch_config(self):
instance_type = 'm1.large',
security_groups = ['group1', 'group2'],
spot_price='price',
block_device_mappings = [bdm]
block_device_mappings = [bdm],
associate_public_ip_address = True
)

response = self.service_connection.create_launch_configuration(lc)
Expand All @@ -248,6 +249,7 @@ def test_launch_config(self):
'SecurityGroups.member.1': 'group1',
'SecurityGroups.member.2': 'group2',
'SpotPrice': 'price',
'AssociatePublicIpAddress' : 'true'
}, ignore_params_values=['Version'])


Expand Down

0 comments on commit 6685adb

Please sign in to comment.