function buildInstance()

in src/aws/ec2Instances.ts [13:20]


function buildInstance(instance: EC2Instance): Instance {
    const autoScalingGroupNameTag = instance.Tags!.find(({ Key }) => Key === "aws:autoscaling:groupName");
    if(!autoScalingGroupNameTag) {
        throw new Error(`Missing aws:autoscaling:groupName tag on instance ${instance.InstanceId}`);
    }

    return new Instance(instance.InstanceId, instance.LaunchTime, instance.PrivateIpAddress, autoScalingGroupNameTag!.Value);
}