aws-sdk-java
aws-sdk-java copied to clipboard
Provide a securityGroupExists(String name) method similar to the S3 bucketExists() one
Currently checking if a security group exists, one must catch an Exception:
try {
amazonEC2.describeSecurityGroups(new DescribeSecurityGroupsRequest().withGroupNames(ec2SecurityGroup));
return; //Success, it already exists.
} catch (AmazonServiceException e) {
//The security group doesn't exist.
}
Having a dedicated method would make this much better.
Since the ec2 client is code generated (s3 client is not though), we in general prefer to create separate utility classes for any high-level logic that does not directly map to an existing service API. The pull-request linked above looks promising. I will close this issue for now and work on getting that change merged asap.