unsupported protocol scheme while creating ec2 Security group

那年仲夏 提交于 2019-12-12 02:26:05

问题


I am trying to create security group using goamz. Below is my code.

package main
import (
    "fmt"
    "os"
    "github.com/mitchellh/goamz/aws"
    "github.com/mitchellh/goamz/ec2"
)
type SecurityGroup struct {
    Id string `xml:"groupId"`   
    Name string `xml:"groupName"` 
    Description string `xml:"groupDescription"`
    VpcId string `xml:"vpcId"`
}

func main() {
    auth := aws.Auth{
        AccessKey: os.Getenv("key"),
        SecretKey: os.Getenv("secret"),
    }
    region := aws.Region{
        Name : "us-east-1",
    }
    ec2conn := ec2.New(auth, region)
    fmt.Printf("%+v\n", ec2conn)
    resp, err := ec2conn.CreateSecurityGroup(ec2.SecurityGroup{Name: "testing12", 
                                          Description: "testing123", VpcId: "vpc-123456"})
    fmt.Printf("%+v\n", resp)
    if err != nil {
        fmt.Printf("%s\n", err.Error())
    }
}

And I get the below Response upon execution. <nil> Get /? XXXXXXXXX unsupported protocol scheme "" I am not sure whether we use any protocol explicitly to create. Please help me understanding this.

来源:https://stackoverflow.com/questions/26505623/unsupported-protocol-scheme-while-creating-ec2-security-group

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!