diff --git a/cmd/metadata/init.go b/cmd/metadata/init.go index b6cac9d..2824cf2 100644 --- a/cmd/metadata/init.go +++ b/cmd/metadata/init.go @@ -22,4 +22,5 @@ var ( func init() { MetadataCmd.AddCommand(regionCmd) MetadataCmd.AddCommand(instanceIdCmd) + MetadataCmd.AddCommand(instanceTypeCmd) } diff --git a/cmd/metadata/instance_type.go b/cmd/metadata/instance_type.go new file mode 100644 index 0000000..0d6f2d3 --- /dev/null +++ b/cmd/metadata/instance_type.go @@ -0,0 +1,24 @@ +package metadata + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var ( + instanceTypeCmd = &cobra.Command{ + Use: "instance-type", + Short: "get own EC2 instance type", + RunE: func(cmd *cobra.Command, args []string) error { + + instanceType, err := client.GetMetadata("instance-type") + if err != nil { + return err + } + + fmt.Println(instanceType) + return nil + }, + } +)