public List < Tag > getInstanceTags ( ) { final DescribeInstancesResult response = ec2 . describeInstances ( new DescribeInstancesRequest ( ) . withInstanceIds ( Collections . singletonList ( instanceIdentity . instanceId ) ) ) ; return response . getReservations ( ) . stream ( ) . flatMap ( reservation -> reservation . getInstances ( ) . stream ( ) ) . flatMap ( instance -> instance . getTags ( ) . stream ( ) ) . collect ( Collectors . toList ( ) ) ; }
Returns all of the tags defined on the EC2 current instance instanceId .