//attachTags makes a call to EC2 to attach the given map of tags to a resource. func attachTags(ec2Handle *ec2.EC2, tags map[string]string, instance string) error { tagSlice := []ec2.Tag{} for tag, value := range tags { tagSlice = append(tagSlice, ec2.Tag{tag, value}) } _, err := ec2Handle.CreateTags([]string{instance}, tagSlice) return err }