await getInstancesByTag()

in src/getTargetNode.ts [23:42]


      await getInstancesByTag(event.autoScalingGroupDiscoveryTagKey, "true")
    ).filter(i => eligibleASGs.includes(i.autoScalingGroupName));

    // We can manually run rotation against a particular instance if needed
    if(event.targetInstanceId) {
        const targetInstance = eligibleInstances.find(i => i.id === event.targetInstanceId);
        if(!targetInstance){
            throw Error(
              `The specified 'targetInstanceId' doesn't belong to an ASG with the 
              '${event.autoScalingGroupDiscoveryTagKey}' Tag set to 'true', 
              or the instance itself doesn't have that tag set to true.`
            );
        }
        const asgName = targetInstance.autoScalingGroupName;
        const targetInstanceId = targetInstance.id;
        const elasticsearchClient = new Elasticsearch(targetInstanceId);
        const targetElasticSearchNode = await elasticsearchClient.getElasticsearchNode(targetInstance);
        console.log(`Instance ${targetInstanceId} (ASG: ${asgName}) specified as input. Moving on...`);
        return { asgName, targetElasticSearchNode, skipRotation: false };
    }