Repository: getmoto/moto

Issue:
Complete ARN in update_container_instance_state should work
Hi, 
According to the boto3 documentation, calling `update_container_instances_state` on the ecs client passing the full ARN as the containerInstance parameter should work: http://boto3.readthedocs.io/en/latest/reference/services/ecs.html#ECS.Client.update_container_instances_state (in fact it does work using the real boto3 API). However, using moto, it only works when passing the container instance id rather than the full ARN.

**how to reproduce the issue**
small test fished out of test I was writing for other stuff
```
import json

import boto3
from moto import mock_ec2, mock_autoscaling, mock_ecs
from moto.ec2 import utils as ec2_utils


@mock_ec2
@mock_ecs
@mock_autoscaling
def test_drain_ecs_instance_if_running_tasks():
    fake_asg_client = boto3.client('autoscaling')
    fake_ec2_client = boto3.client('ec2')
    fake_ecs_client = boto3.client('ecs')

    auto_scaling_group_name = 'TestGroup1'

    fake_asg_client.create_launch_configuration(
        LaunchConfigurationName='TestLC'
    )

    fake_asg_client.create_auto_scaling_group(
        AutoScalingGroupName=auto_scaling_group_name,
        MinSize=1,
        MaxSize=1,
        LaunchConfigurationName='TestLC'
    )

    instances = fake_ec2_client.describe_instances()

    instance_id = instances['Reservations'][0]['Instances'][0]['InstanceId']

    cluster_name = 'test_ecs_cluster'
    cluster_response = fake_ecs_client.create_cluster(
        clusterName=cluster_name
    )

    ec2 = boto3.resource('ec2')
    instance = ec2.Instance(instance_id)

    instance_id_document = json.dumps(
        ec2_utils.generate_instance_identity_document(instance)
    )

    container_instance_response = fake_ecs_client.register_container_instance(
        cluster=cluster_name,
        instanceIdentityDocument=instance_id_document
    )

    container_instance_arn = container_instance_response['containerInstance']['containerInstanceArn']
    cluster_arn = cluster_response['cluster']['clusterArn']
    print(container_instance_arn)

    resp = fake_ecs_client.update_container_instances_state(
        cluster=cluster_arn,
        containerInstances=[
            container_instance_arn,
        ],
        status='DRAINING'
    )
    print(f'Updating container instance response:\n{resp}')

    container_instance_info = fake_ecs_client.describe_container_instances(
        cluster=cluster_name,
        containerInstances=[container_instance_arn]
    )

    assert container_instance_info['containerInstances'][0]['status'] == "DRAINING"
```

**what you expected to happen**
Test should pass

**what actually happens**
Test fails. 
Py.test output:
```
>       assert container_instance_info['containerInstances'][0]['status'] == "DRAINING"
E       AssertionError: assert 'ACTIVE' == 'DRAINING'
E         - ACTIVE
E         + DRAINING

test_moto.py:69: AssertionError
----------------------------- Captured stdout call -----------------------------
arn:aws:ecs:us-east-1:012345678910:container-instance/7d0190d2-6872-11e7-b914-186590d23c23
Updating container instance response:
{'containerInstances': [], 'failures': [{'arn': 'arn:aws:ecs:us-east-1:012345678910:container-instance/arn:aws:ecs:us-east-1:012345678910:container-instance/7d0190d2-6872-11e7-b914-186590d23c23', 'reason': 'MISSING'}], 'ResponseMetadata': {'HTTPStatusCode': 200, 'HTTPHeaders': {'Content-Type': 'text/plain', 'server': 'amazon.com'}, 'RetryAttempts': 0}}
=========================== 1 failed in 1.23 seconds ===========================
```
Note the return of the status update request where it says that it tried to update the status of `arn:aws:ecs:us-east-1:012345678910:container-instance/arn:aws:ecs:us-east-1:012345678910:container-instance/7d0190d2-6872-11e7-b914-186590d23c23`

**what version of Moto you're using**
moto-2.0.0

**how you installed it**
`pip3 install moto`




Discussion:
@alicefuzier This is so helpful! Thank you for bringing this up. Would you like to try implementing a fix for this? If you get stuck I'd be happy to help out.

Resolving patch:
diff --git a/moto/ecs/models.py b/moto/ecs/models.py
--- a/moto/ecs/models.py
+++ b/moto/ecs/models.py
@@ -769,6 +769,8 @@ def update_container_instances_state(self, cluster_str, list_container_instance_
                             Container instances status should be one of [ACTIVE,DRAINING]")
         failures = []
         container_instance_objects = []
+        list_container_instance_ids = [x.split('/')[-1]
+                            for x in list_container_instance_ids]
         for container_instance_id in list_container_instance_ids:
             container_instance = self.container_instances[cluster_name].get(container_instance_id, None)
             if container_instance is not None:


Test patch:
diff --git a/tests/test_ecs/test_ecs_boto3.py b/tests/test_ecs/test_ecs_boto3.py
--- a/tests/test_ecs/test_ecs_boto3.py
+++ b/tests/test_ecs/test_ecs_boto3.py
@@ -910,6 +910,65 @@ def test_update_container_instances_state():
                                                                  status='test_status').should.throw(Exception)
 
 
+@mock_ec2
+@mock_ecs
+def test_update_container_instances_state_by_arn():
+    ecs_client = boto3.client('ecs', region_name='us-east-1')
+    ec2 = boto3.resource('ec2', region_name='us-east-1')
+
+    test_cluster_name = 'test_ecs_cluster'
+    _ = ecs_client.create_cluster(
+        clusterName=test_cluster_name
+    )
+
+    instance_to_create = 3
+    test_instance_arns = []
+    for i in range(0, instance_to_create):
+        test_instance = ec2.create_instances(
+            ImageId="ami-1234abcd",
+            MinCount=1,
+            MaxCount=1,
+        )[0]
+
+        instance_id_document = json.dumps(
+            ec2_utils.generate_instance_identity_document(test_instance)
+        )
+
+        response = ecs_client.register_container_instance(
+            cluster=test_cluster_name,
+            instanceIdentityDocument=instance_id_document)
+
+        test_instance_arns.append(response['containerInstance']['containerInstanceArn'])
+
+    response = ecs_client.update_container_instances_state(cluster=test_cluster_name,
+                                                           containerInstances=test_instance_arns,
+                                                           status='DRAINING')
+    len(response['failures']).should.equal(0)
+    len(response['containerInstances']).should.equal(instance_to_create)
+    response_statuses = [ci['status'] for ci in response['containerInstances']]
+    for status in response_statuses:
+        status.should.equal('DRAINING')
+    response = ecs_client.update_container_instances_state(cluster=test_cluster_name,
+                                                           containerInstances=test_instance_arns,
+                                                           status='DRAINING')
+    len(response['failures']).should.equal(0)
+    len(response['containerInstances']).should.equal(instance_to_create)
+    response_statuses = [ci['status'] for ci in response['containerInstances']]
+    for status in response_statuses:
+        status.should.equal('DRAINING')
+    response = ecs_client.update_container_instances_state(cluster=test_cluster_name,
+                                                           containerInstances=test_instance_arns,
+                                                           status='ACTIVE')
+    len(response['failures']).should.equal(0)
+    len(response['containerInstances']).should.equal(instance_to_create)
+    response_statuses = [ci['status'] for ci in response['containerInstances']]
+    for status in response_statuses:
+        status.should.equal('ACTIVE')
+    ecs_client.update_container_instances_state.when.called_with(cluster=test_cluster_name,
+                                                                 containerInstances=test_instance_arns,
+                                                                 status='test_status').should.throw(Exception)
+
+
 @mock_ec2
 @mock_ecs
 def test_run_task():