use of software.amazon.awssdk.services.ec2.model.DeleteSecurityGroupRequest in project aws-doc-sdk-examples by awsdocs.
the class DeleteSecurityGroup method deleteEC2SecGroup.
// snippet-start:[ec2.java2.delete_security_group.main]
public static void deleteEC2SecGroup(Ec2Client ec2, String groupId) {
try {
DeleteSecurityGroupRequest request = DeleteSecurityGroupRequest.builder().groupId(groupId).build();
ec2.deleteSecurityGroup(request);
System.out.printf("Successfully deleted Security Group with id %s", groupId);
} catch (Ec2Exception e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations