Navigation Menu

Skip to content

Commit

Permalink
run_instance tweaks: Cannot submit subnet with group name; must use g…
Browse files Browse the repository at this point in the history
…roup id instead. Added support for this edge condition. Also added PrivateIpAddress option.
  • Loading branch information
Brett Paden committed Jan 17, 2013
1 parent b68d732 commit bd8bf05
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lib/Net/Amazon/EC2.pm
Expand Up @@ -3602,6 +3602,10 @@ The keypair name to associate this instance with. If omitted, will use your def
An scalar or array ref. Will associate this instance with the group names passed in. If omitted, will be associated with the default security group.
=item SecurityGroupId (optional)
An scalar or array ref. Will associate this instance with the group ids passed in. If omitted, will be associated with the default security group.
=item AdditionalInfo (optional)
Specifies additional information to make available to the instance(s).
Expand Down Expand Up @@ -3718,6 +3722,10 @@ Specifies the idempotent instance id.
Whether the instance is optimized for EBS I/O.
=item PrivateIpAddress (optional)
Specifies the private IP address to use when launching an Amazon VPC instance.
=back
Returns a Net::Amazon::EC2::ReservationInfo object
Expand All @@ -3732,6 +3740,7 @@ sub run_instances {
MaxCount => { type => SCALAR },
KeyName => { type => SCALAR, optional => 1 },
SecurityGroup => { type => SCALAR | ARRAYREF, optional => 1 },
SecurityGroupId => { type => SCALAR | ARRAYREF, optional => 1 },
AdditionalInfo => { type => SCALAR, optional => 1 },
UserData => { type => SCALAR, optional => 1 },
InstanceType => { type => SCALAR, optional => 1 },
Expand All @@ -3750,7 +3759,8 @@ sub run_instances {
DisableApiTermination => { type => SCALAR, optional => 1 },
InstanceInitiatedShutdownBehavior => { type => SCALAR, optional => 1 },
ClientToken => { type => SCALAR, optional => 1 },
EbsOptimized => { type => SCALAR, optional => 1 },
EbsOptimized => { type => SCALAR, optional => 1 },
PrivateIpAddress => { type => SCALAR, optional => 1 },
});

# If we have a array ref of instances lets split them out into their SecurityGroup.n format
Expand All @@ -3763,6 +3773,16 @@ sub run_instances {
}
}

# If we have a array ref of instances lets split them out into their SecurityGroupId.n format
if (ref ($args{SecurityGroupId}) eq 'ARRAY') {
my $security_groups = delete $args{SecurityGroupId};
my $count = 1;
foreach my $security_group (@{$security_groups}) {
$args{"SecurityGroupId." . $count} = $security_group;
$count++;
}
}

# If we have a array ref of block device virtual names lets split them out into their BlockDeviceMapping.n.VirtualName format
if (ref ($args{'BlockDeviceMapping.VirtualName'}) eq 'ARRAY') {
my $virtual_names = delete $args{'BlockDeviceMapping.VirtualName'};
Expand Down

0 comments on commit bd8bf05

Please sign in to comment.