private void tagResources ( List < String > resources , List < Tag > tags ) { // Create a tag request. CreateTagsRequest createTagsRequest = new CreateTagsRequest ( ) ; createTagsRequest . setResources ( resources ) ; createTagsRequest . setTags ( tags ) ; // Try to tag the Spot request submitted. try { ec2 . createTags ( createTagsRequest ) ; } catch ( AmazonServiceException e ) { // Write out any exceptions that may have occurred. System . out . println ( "Error terminating instances" ) ; System . out . println ( "Caught Exception: " + e . getMessage ( ) ) ; System . out . println ( "Reponse Status Code: " + e . getStatusCode ( ) ) ; System . out . println ( "Error Code: " + e . getErrorCode ( ) ) ; System . out . println ( "Request ID: " + e . getRequestId ( ) ) ; } }
Tag any of the resources we specify .