Documentation ¶
Index ¶
- Variables
- func Connect(host string, username string, methods ...ssh.AuthMethod) (*ssh.Client, error)
- func CreateEC2KeyPair(region string, keyname string) error
- func CreateInstance(region string, keypair string, sgparam string, amid string) (string, error)
- func CreateSecurityGroupForSSH(region string, name string, description string) (string, error)
- func DeleteEC2KeyPair(region string, keyname string) error
- func GetAmazonImageID(region string) string
- func GetEC2ServiceClient(region string) (*ec2.EC2, error)
- func GetKeyPairs(region string) ([]string, error)
- func GetSecurityGroupID(region string) string
- func KeyPair(keyFile string) (ssh.AuthMethod, error)
- func ListAllEC2KeyPairs(region string) ([]*ec2.KeyPairInfo, error)
- func ListAllSecurityGroups(region string, sgID string) ([]*ec2.SecurityGroup, error)
- func OpenSession(username string, ipaddress string, keyname string)
- func PlotGraph(region string, instanceID string, data []Metric)
- func RenderGraphs(metricArray []Metric)
- func SSHAgent() (ssh.AuthMethod, error)
- func StartInstance(region string, instanceID string) error
- func StopInstance(region string, instanceID string) error
- func TagInstance(region string, instanceid string, nametag string) error
- func TerminateInstanceByID(region string, instanceID string) error
- type Metric
Constants ¶
This section is empty.
Variables ¶
var AllRegions = []string{
"us-east-2",
"us-east-1",
"us-west-1",
"us-west-2",
"ap-south-1",
"ap-northeast-3",
"ap-northeast-2",
"ap-southeast-1",
"ap-southeast-2",
"ap-northeast-1",
"ca-central-1",
"cn-north-1",
"cn-northwest-1",
"eu-central-1",
"eu-west-1",
"eu-west-2",
"eu-west-3",
"sa-east-1",
"us-gov-east-1",
"us-gov-west-1",
}
AllRegions is a vsriable that stores all possible AWS regions
Functions ¶
func Connect ¶
Connect is a function to configure the connection with username, authentication methods
func CreateEC2KeyPair ¶
CreateEC2KeyPair creates a new AWS SSH Secret key and puts the secret content in a file in ~/.ssh/ dir
func CreateInstance ¶
CreateInstance is for creating EC2 instances for given region, keypair, SG and AMI-ID
func CreateSecurityGroupForSSH ¶
CreateSecurityGroupForSSH is a function to create security group that allows SSN through on TCP/22 returns (string, error) that point to SG-ID and error if any during execution
func DeleteEC2KeyPair ¶
DeleteEC2KeyPair is a function to delete specified key in specified region
func GetAmazonImageID ¶
GetAmazonImageID is a function storing ami IDs anre returning then based on region
func GetEC2ServiceClient ¶
GetEC2ServiceClient it is helper function to validate region and open SVC session to EC2
func GetKeyPairs ¶
GetKeyPairs returns EC2 key pairs from given account for given region
func GetSecurityGroupID ¶
GetSecurityGroupID is a func that returns SG ID basedo n region
func KeyPair ¶
func KeyPair(keyFile string) (ssh.AuthMethod, error)
KeyPair is a function to help retrieve the key from the filesystem, assumes it to be under ~/.ssh/ folder
func ListAllEC2KeyPairs ¶
func ListAllEC2KeyPairs(region string) ([]*ec2.KeyPairInfo, error)
ListAllEC2KeyPairs is a function to list all AWS KeyPairs in region specified
func ListAllSecurityGroups ¶
func ListAllSecurityGroups(region string, sgID string) ([]*ec2.SecurityGroup, error)
ListAllSecurityGroups is a function to list all security groups, if sgID is "" then it lists all in the region
func OpenSession ¶
OpenSession helps to open the session in an interactive way in current terminal session
func RenderGraphs ¶
func RenderGraphs(metricArray []Metric)
RenderGraphs is helper func to render graphs
func StartInstance ¶
StartInstance is helper func to start instance in region with given InstanceID
func StopInstance ¶
StopInstance is helper func to stop instance with given ID in given region
func TagInstance ¶
TagInstance is a helper function to tag a newly created instance
func TerminateInstanceByID ¶
TerminateInstanceByID is helper func to terminate instance by ID