我正在创建安全组,并允许使用以下代码为所有ips打开TCP和HTTP的入站协议:
IpPermission ipPermission = new IpPermission();
ipPermission.withIpRanges("0.0.0.0/0")
.withIpProtocol("tcp")
.withFromPort(22)
.withToPort(22);
ipPermission.withIpRanges("0.0.0.0/0")
.withIpProtocol("http")
.withFromPort(80)
.withToPort(80);
AuthorizeSecurityGroupIngressRequest authorizeSecurityGroupIngressRequest =
new AuthorizeSecurityGroupIngressRequest();
authorizeSecurityGroupIngressRequest.withGroupName("JavaSecurityGroup")
.withIpPermissions(ipPermission);
amazonEC2Client.authorizeSecurityGroupIngress(authorizeSecurityGroupIngressRequest);
然而,它给了我以下错误: 无效的值' http'用于IP协议。未知协议
答案 0 :(得分:3)