Only the custodial parent may claim the earned income credit (EIC) and the Child and Dependent Care Credit (the credit for childcare expenses). The custodial parent may sign Form 8332 to let the noncustodial parent claim the dependency exemption and the Child Tax Credit. The IRS considers the custodial parent to be the parent with whom the child spent more nights during the tax year. Since there were 365 days in 2017, your son should have spent more nights with either you or your ex-wife during the tax year even with 50-50 custody. That parent is the custodial parent.
Note that tax year 2018 will be a little different since the dependent exemption goes away and the Child Tax Credit increases.