Example usage for com.amazonaws.services.ec2 AmazonEC2 createInternetGateway

List of usage examples for com.amazonaws.services.ec2 AmazonEC2 createInternetGateway

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2 AmazonEC2 createInternetGateway.

Prototype

CreateInternetGatewayResult createInternetGateway(CreateInternetGatewayRequest createInternetGatewayRequest);

Source Link

Document

Creates an internet gateway for use with a VPC.

Usage

From source file:com.urbancode.terraform.tasks.aws.helpers.AWSHelper.java

License:Apache License

/**
 * Creates an internetGateway and returns the id it was created with.
 *
 * @param ec2Client/*from  www  .  j  ava 2 s. c o  m*/
 * @return InternetGatewayId
 */
public String createInternetGateway(AmazonEC2 ec2Client) {
    String gatewayId = null;

    CreateInternetGatewayRequest request = new CreateInternetGatewayRequest();
    CreateInternetGatewayResult result = ec2Client.createInternetGateway(request);

    if (result != null && result.getInternetGateway() != null) {
        gatewayId = result.getInternetGateway().getInternetGatewayId();
    }

    return gatewayId;
}