List of usage examples for com.amazonaws.services.ec2.model AssociateRouteTableResult getAssociationId
public String getAssociationId()
The route table association ID.
From source file:com.urbancode.terraform.tasks.aws.helpers.AWSHelper.java
License:Apache License
/** * * @param routeTableId//from w w w . j a v a 2 s . c o m * @param subnetId * @param ec2Client * @return */ public String associateRouteTableWithSubnet(String routeTableId, String subnetId, AmazonEC2 ec2Client) { String assId = null; try { AssociateRouteTableRequest request = new AssociateRouteTableRequest().withRouteTableId(routeTableId) .withSubnetId(subnetId); AssociateRouteTableResult result = ec2Client.associateRouteTable(request); if (result != null) { assId = result.getAssociationId(); } } catch (AmazonServiceException e) { log.error("Failed to associate Route Table with Subnet", e); if (!"InvalidRouteTableID.NotFound".equalsIgnoreCase(e.getErrorCode())) { throw e; } } return assId; }