Example usage for com.amazonaws.services.ec2.model AuthorizeSecurityGroupIngressRequest getIpProtocol

List of usage examples for com.amazonaws.services.ec2.model AuthorizeSecurityGroupIngressRequest getIpProtocol

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model AuthorizeSecurityGroupIngressRequest getIpProtocol.

Prototype


public String getIpProtocol() 

Source Link

Document

<p> The IP protocol name (<code>tcp</code>, <code>udp</code>, <code>icmp</code>) or number (see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml">Protocol Numbers</a>).

Usage

From source file:org.excalibur.service.aws.ec2.EC2.java

License:Open Source License

protected void authorizeTcpAndSshIngressTraffic(String groupName) {
    LOG.debug("Adding a TCP ingress rule for the security group [{}].", groupName);

    AuthorizeSecurityGroupIngressRequest authorizeSecurityGroupIngressRequest = new AuthorizeSecurityGroupIngressRequest()
            .withFromPort(0).withToPort(65535).withIpProtocol("tcp").withGroupName(groupName)
            .withCidrIp("0.0.0.0/0");

    ec2_.authorizeSecurityGroupIngress(authorizeSecurityGroupIngressRequest);

    LOG.debug(// www  .j a  v  a2  s.co m
            "The following ingress rule was created. Security group [{}], protocol [{}] from port [{}] to port [{}] and "
                    + "CIDR IP address [{}], region [{}]",
            authorizeSecurityGroupIngressRequest.getGroupName(),
            authorizeSecurityGroupIngressRequest.getIpProtocol(),
            authorizeSecurityGroupIngressRequest.getFromPort(),
            authorizeSecurityGroupIngressRequest.getToPort(), authorizeSecurityGroupIngressRequest.getCidrIp(),
            DEFAULT_API_REGION.getName());

    authorizeSecurityGroupIngressRequest.withFromPort(22).withToPort(22);
    ec2_.authorizeSecurityGroupIngress(authorizeSecurityGroupIngressRequest);

}