Created
June 24, 2014 03:21
-
-
Save futoase/1d00e7cd6d056bb7a635 to your computer and use it in GitHub Desktop.
example for crowdmob/goamz
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
| package main | |
| import ( | |
| "github.com/crowdmob/goamz/aws" | |
| "github.com/crowdmob/goamz/ec2" | |
| "fmt" | |
| ) | |
| func main() { | |
| auth, err := aws.EnvAuth() | |
| if err != nil { | |
| panic(err) | |
| } | |
| e := ec2.New(auth, aws.APNortheast) | |
| result, _ := e.DescribeInstances(nil, nil) | |
| for _, reservation := range result.Reservations { | |
| for _, instance := range reservation.Instances { | |
| fmt.Printf("Instance id is: %s\n", instance.InstanceId) | |
| fmt.Printf("Instance type is: %s\n", instance.InstanceType) | |
| fmt.Printf("Availability Zone is: %s\n", instance.AvailabilityZone) | |
| fmt.Printf("State is %s\n", instance.State.Name) | |
| fmt.Printf("IP Address is %s\n", instance.IPAddress) | |
| fmt.Printf("DNSName is %s\n", instance.DNSName) | |
| fmt.Printf("LaunchTime is %s\n", instance.LaunchTime) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment