diff --git a/lib/VM/EC2/REST/ebs.pm b/lib/VM/EC2/REST/ebs.pm index d1bd1ea..ecf0cec 100644 --- a/lib/VM/EC2/REST/ebs.pm +++ b/lib/VM/EC2/REST/ebs.pm @@ -104,7 +104,9 @@ Arguments: -snapshot_id -- ID of a snapshot to use to build volume from. - -size -- Size of the volume, in GB (between 1 and 1024). + -size -- Size of the volume, in GB. + gp2, io1: between 1 and 16384 + standard: between 1 and 1024 One or both of -snapshot_id or -size are required. For convenience, you may abbreviate -availability_zone as -zone, and -snapshot_id as @@ -116,7 +118,7 @@ Optional Arguments: Default is "standard" -iops -- The number of I/O operations per second (IOPS) that - the volume supports. Range is 100 to 4000. Required + the volume supports. Range is 100 to 20000. Required when volume type is io1. IOPS must be 30-to-1 ratio to size. ie: 3000 IOPS volume must be at least 100GB. diff --git a/lib/VM/EC2/REST/instance.pm b/lib/VM/EC2/REST/instance.pm index 85860de..c393d2f 100644 --- a/lib/VM/EC2/REST/instance.pm +++ b/lib/VM/EC2/REST/instance.pm @@ -289,7 +289,7 @@ following: "gp2" is the new general purpose SSD type. - '': The number of I/O operations per second (IOPS) that - the volume suports. A number between 100 to 4000. Only valid + the volume suports. A number between 100 to 20000. Only valid for volumes of type "io1". Examples: -block_devices => '/dev/sdb=snap-7eb96d16' diff --git a/lib/VM/EC2/REST/vpc.pm b/lib/VM/EC2/REST/vpc.pm index c6526e2..99f1b68 100644 --- a/lib/VM/EC2/REST/vpc.pm +++ b/lib/VM/EC2/REST/vpc.pm @@ -7,6 +7,8 @@ package VM::EC2; # add methods to VM::EC2 VM::EC2::Dispatch->register( AcceptVpcPeeringConnection => 'fetch_one,vpcPeeringConnection,VM::EC2::VPC::PeeringConnection', CreateVpc => 'fetch_one,vpc,VM::EC2::VPC', + CreateVpcEndpoint => 'fetch_one,vpcEndpoint,VM::EC2::VPC::Endpoint', + DeleteVpcEndpoints => 'fetch_one,unsuccessful,VM::EC2::VPC::Unsuccessful', CreateVpcPeeringConnection => 'fetch_one,vpcPeeringConnection,VM::EC2::VPC::PeeringConnection', DeleteVpc => 'boolean', DeleteVpcPeeringConnection => 'boolean', @@ -34,8 +36,10 @@ extending your home/corporate network into the cloud. Implemented: AcceptVpcPeeringConnection CreateVpc + CreateVpcEndpoint CreateVpcPeeringConnection DeleteVpc + DeleteVpcEndpoints DeleteVpcPeeringConnection DescribeVpcPeeringConnections DescribeVpcs @@ -44,6 +48,10 @@ Implemented: RejectVpcPeeringConnection Unimplemented: + DescribePrefixLists + DescribeVpcEndpoints + DescribeVpcEndpointServices + ModifyVpcEndpoint (none) =cut @@ -126,6 +134,59 @@ sub create_vpc { return $self->call('CreateVpc',@param); } +=head2 $ep = $ec2->create_vpc_endpoint(%args) + +Creates a VPC endpoint for a specified AWS service. An endpoint enables creation +of a private connection between a VPC and another AWS service in the same +account. An endpoint policy can be attached to the endpoint that will control +access to the service from the VPC. VPC route tables can be specified that use +the endpoint. + +Required arguments: + + -service_name The AWS service name, in the form: + com.amazonaws.. + To get a list of available services, use the + describe_vpc_endpoint_services() call. + + -vpc_id The ID of the VPC in which the endpoint will be used. + +Optional arguments: + + -client_token Unique, case-sensitive identifier you provide to ensure the + idempotency of the request. + + -dry_run Checks whether the required permissions for the action are + available, without actually making the request, and provides + an error response. If the required permissions are possessed, + the error response is 'DryRunOperation'. Otherwise, it is + 'UnauthorizedOperation' + + -policy_document A policy to attach to the endpoint that controls access to + the service. The policy must be in valid JSON format. If this + parameter is not specified, a default policy that allows full + access to the service is attached. + + -route_table One or more route table IDs. Can be arrayref or scalar. + +=cut + +sub create_vpc_endpoint { + my $self = shift; + my %args = @_; + $args{-vpc_id} or + croak "create_vpc_peering_connection(): -vpc_id argument required"; + $args{-peer_vpc_id} or + croak "create_vpc_peering_connection(): -peer_vpc_id argument required"; + my @param = $VEP->format_parms(\%args, + { + boolean_parm => 'DryRun', + single_parm => [qw(ClientToken PolicyDocument ServiceName VpcId)], + list_parm => 'RouteTableId', + }); + return $self->call('CreateVpcEndpoint',@param); +} + =head2 $pcx = $ec2->create_vpc_peering_connection(-vpc_id => $vpc_id, -peer_vpc_id => $peer_id, -peer_owner_id => $owner_id) @@ -254,6 +315,36 @@ sub delete_vpc { return $self->call('DeleteVpc',@param); } +=head2 $success = $ec2->delete_vpc_endpoints(-vpc_endpoint_id => $id, -dry_run => $bool) + +Deletes one or more specified VPC endpoints. Deleting the endpoint also deletes +the endpoint routes in the route tables that were associated with the endpoint. + +Required arguments: + + -vpc_endpoint_id One or more endpoint IDs. Can be scalar or arrayref. + +Optional arguments: + + -dry_run Checks whether the required permissions for the action are + possessed, without actually making the request, and provides + an error response. If the required permissions are possessed, + the error response is 'DryRunOperation'. Otherwise, it is + 'UnauthorizedOperation'. + +=cut + +sub delete_vpc_endpoints { + my $self = shift; + my %args = $VEP->args(-vpc_endpoint_id,@_); + my @param = $VEP->format_parms(\%args, + { + list_parm => 'VpcEndpointId', + boolean_parm => 'DryRun', + }); + return $self->call('DeleteVpcEndpoints',@param); +} + =head2 $success = $ec2->delete_vpc_peering_connection(-vpc_peering_connection_id => $id) =head2 $success = $ec2->delete_vpc_peering_connection($id) diff --git a/lib/VM/EC2/Snapshot.pm b/lib/VM/EC2/Snapshot.pm index 23b159e..7f7e00f 100644 --- a/lib/VM/EC2/Snapshot.pm +++ b/lib/VM/EC2/Snapshot.pm @@ -131,18 +131,20 @@ Create a new volume from this snapshot. Arguments are: -availability_zone -- An availability zone from describe_availability_zones (required) - -size -- Size of the volume, in GB (between 1 and 1024). + -size -- Size of the volume, in GB. + io1, gp2: between 1 and 16384 + standard: between 1 and 1024 If -size is not provided, then the new volume will have the same size as the snapshot. Optional Arguments: - -volume_type -- The volume type. standard or io1, default is + -volume_type -- The volume type. standard, gp2, or io1, default is standard -iops -- The number of I/O operations per second (IOPS) that - the volume supports. Range is 100 to 4000. Required + the volume supports. Range is 100 to 20000. Required when volume type is io1. IOPS must be 30-to-1 ratio to size. ie: 3000 IOPS volume must be at least 100GB. diff --git a/lib/VM/EC2/VPC/Endpoint.pm b/lib/VM/EC2/VPC/Endpoint.pm new file mode 100644 index 0000000..45b3257 --- /dev/null +++ b/lib/VM/EC2/VPC/Endpoint.pm @@ -0,0 +1,84 @@ +package VM::EC2::VPC::Endpoint; + +=head1 NAME + +VM::EC2::VPC::Endpoint - Virtual Private Cloud Endpoint + +=head1 SYNOPSIS + + use VM::EC2; + + my $ec2 = VM::EC2->new(...); + my @ep = $ec2->describe_vpc_endpoints(); + print $_->vpcEndpointId,"\n" foreach @ep; + +=head1 DESCRIPTION + +This object represents an Amazon EC2 VPC Endpoint returned by +VM::EC2->describe_vpc_endpoints() + +=head1 METHODS + +These object methods are supported: + + creationTimestamp -- The date and time the VPC endpoint was created. + + policyDocument -- The policy document associated with the + endpoint. + routeTableIds -- One or more route tables associated with the + endpoint. + + serviceName -- The name of the AWS service to which the + endpoint is associated. + + state -- The state of the VPC endpoint. + Valid Values: Pending | Available | + Deleting | Deleted + + vpcEndpointId -- The ID of the VPC endpoint. + + vpcId -- The ID of the VPC to which the endpoint is + associated. + +=head1 STRING OVERLOADING + +When used in a string context, this object will interpolate a string +containing the VPC ID. + +=head1 SEE ALSO + +L +L + +=head1 AUTHOR + +Lance Kinley Elkinley@loyaltymethods.comE. + +Copyright (c) 2015 Loyalty Methods, Inc. + +This package and its accompanying libraries is free software; you can +redistribute it and/or modify it under the terms of the GPL (either +version 1, or at your option, any later version) or the Artistic +License 2.0. Refer to LICENSE for the full license text. In addition, +please see DISCLAIMER.txt for disclaimers of warranty. + +=cut + +use strict; +use base 'VM::EC2::Generic'; +use Carp 'croak'; + +use overload + '""' => sub { + my $self = shift; + return $self->vpcId }, + fallback => 1; + +sub valid_fields { + my $self = shift; + return qw(creationTimestamp policyDocument routeTableIds + serviceName state vpcEndpointId vpcId); +} + +1; + diff --git a/lib/VM/EC2/Volume.pm b/lib/VM/EC2/Volume.pm index dc09a78..9ce932e 100644 --- a/lib/VM/EC2/Volume.pm +++ b/lib/VM/EC2/Volume.pm @@ -45,7 +45,7 @@ The following object methods are supported: createTime -- Timestamp for when volume was created. volumeType -- The volume type, one of "standard", "io1", or "gp2" iops -- The number of I/O operations per second that the volume - supports, an integer between 100 and 4000. Only valid for + supports, an integer between 100 and 20000. Only valid for volumes of type "io1". encrypted -- True if volume is encrypted. tags -- Hashref containing tags associated with this group.