title: How to get public ip address from AWS with Ruby SDK
body: <p>I'm very newbie with AWS.</p>
  
  <p>I would like to get the public IP address from Ruby SDK but can't find how to get it.</p>
  
  <blockquote>
    <p>require 'aws-sdk'</p>
    
    <p>ec2 = Aws::EC2::Resource.new(region: 'us-west-2')</p>
    
    <p>i = ec2.instance('i-XXXXXX')</p>
  </blockquote>
  
  <p>with this two command, I only get state and code.</p>
  
  <p><strong>How to get the public IP address since it usually changes when we shutdown the instance??</strong></p>
  
  <p>Thank in advance</p>