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

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

Introduction

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

Prototype

CreateVpcResult createVpc(CreateVpcRequest createVpcRequest);

Source Link

Document

Creates a VPC with the specified IPv4 CIDR block.

Usage

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

License:Apache License

/**
 *
 * @param cidr// w w w .  ja  v  a2  s  . c  om
 * @param ec2Client
 * @return
 */
public String createVpc(String cidr, AmazonEC2 ec2Client) {
    CreateVpcRequest request = new CreateVpcRequest().withCidrBlock(cidr);
    CreateVpcResult result = ec2Client.createVpc(request);
    String vpcId = result.getVpc().getVpcId();

    return vpcId;
}