Amazon EC2 Tips and Tricks - AWS SDK for Ruby

Amazon EC2 Tips and Tricks

This section provides some tips to help you use the AWS SDK for Ruby with Amazon Elastic Compute Cloud (Amazon EC2) services. For more information about Amazon EC2, see the Amazon EC2 Getting Started Guide.

Switching Elastic IPs

The following example associates the Elastic IP address with the instance represented by i-12345678.

ec2 = resp = ec2.allocate_address ec2.associate_address(instance_id:"i-12345678", allocation_id: resp.allocation_id)