private/test/Test-InstanceId.ps1

function Test-InstanceId
{
    [CmdletBinding(PositionalBinding = $true)]
    [OutputType([bool])]
    param(
        [Parameter(Mandatory = $true)]
        [string] $InstanceId,
        [Parameter(Mandatory = $true)]
        $Ec2Instances
    )

    $found = $Ec2Instances.Where({ $_.InstanceId -eq $InstanceId })

    if ($found)
    {
        return $true
    }
    else
    {
        return $false
    }
}