Created
November 17, 2015 03:18
-
-
Save akkijp/fd7acd461534e1052cc9 to your computer and use it in GitHub Desktop.
aws ec2 のpublic ipを表示させる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'aws-sdk-core' | |
| config = { | |
| :region => "ap-northeast-1" | |
| } | |
| client = Aws::EC2::Client.new( | |
| region: config[:region], | |
| ) | |
| resp = client.describe_instances({ | |
| filters: [ | |
| { | |
| name: "tag-value", | |
| values: ["test"], | |
| }, | |
| ] | |
| }) | |
| puts resp.reservations[0].instances[0].public_ip_address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment