use of software.amazon.awssdk.services.ec2.model.ReleaseAddressResponse in project aws-doc-sdk-examples by awsdocs.
the class ReleaseAddress method releaseEC2Address.
// snippet-start:[ec2.java2.release_instance.main]
public static void releaseEC2Address(Ec2Client ec2, String allocId) {
try {
ReleaseAddressRequest request = ReleaseAddressRequest.builder().allocationId(allocId).build();
ReleaseAddressResponse response = ec2.releaseAddress(request);
System.out.printf("Successfully released elastic IP address %s", allocId);
} catch (Ec2Exception e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations