I'm trying to check whether a specific AMI exists. So, I'm doing:
val filter = new Filter().withName("Name").withValues(amiName)
val result = ec2.describeImages(new DescribeImagesRequest().withFilters(filter))
result.getImages.size() > 0
(code is Scala and not Java, but that's not really relevant). I'm getting the following exception:
com.amazonaws.AmazonServiceException: The filter 'Name' is invalid
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:644) ~[aws-java-sdk-1.4.2.1.jar:na]
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:338) ~[aws-java-sdk-1.4.2.1.jar:na]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:190) ~[aws-java-sdk-1.4.2.1.jar:na]
at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:6199) ~[aws-java-sdk-1.4.2.1.jar:na]
at com.amazonaws.services.ec2.AmazonEC2Client.describeImages(AmazonEC2Client.java:2905) ~[aws-java-sdk-1.4.2.1.jar:na]
How do I correctly define a filter to the DescribeImagesRequest?