// Get all of the keys connected to func getAllKeys(ec2client *ec2.EC2) ([]*ec2.KeyPairInfo, error) { //Get all of the keys keys, err := ec2client.DescribeKeyPairs(&ec2.DescribeKeyPairsInput{}) //If we had an error return it if err != nil { return []*ec2.KeyPairInfo{}, err } //Let's return everything return keys.KeyPairs, nil }