# Getting failure when adding EC2 Host

**URL:** <https://forums.suse.com/t/getting-failure-when-adding-ec2-host/6271>\
**Category:** Rancher 1.x\
**Created:** [April 29, 2017, 4:29pm UTC](https://forums.suse.com/t/getting-failure-when-adding-ec2-host/6271 "2017-04-29T16:29:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveAtInlet](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@SteveAtInlet](https://forums.suse.com/u/SteveAtInlet)\
**Post date:** [April 29, 2017, 4:29pm UTC](https://forums.suse.com/t/getting-failure-when-adding-ec2-host/6271/1 "2017-04-29T16:29:31Z")

</div>

I’m attempting to add an “Amazon EC2” host. It seems to create the instance and connect to it, and gets a fair ways into provisioning it. It errors out with the status “Failed to find rancher-agent container”. At that point, I see this exception in the logs:

> …  
> time=“2017-04-29T16:22:00Z” level=info msg=“Extracting /var/lib/cattle/machine/machines/0683fa7b-cc69-4ba5-acfb-0df3b1dfaac9/machines/RancherAgent5/key.pem”  
> time=“2017-04-29T16:22:00Z” level=info msg=“Extracting /var/lib/cattle/machine/machines/0683fa7b-cc69-4ba5-acfb-0df3b1dfaac9/machines/RancherAgent5/server-key.pem”  
> time=“2017-04-29T16:22:00Z” level=info msg=“Extracting /var/lib/cattle/machine/machines/0683fa7b-cc69-4ba5-acfb-0df3b1dfaac9/machines/RancherAgent5/server.pem”  
> time=“2017-04-29T16:22:00Z” level=info msg=“pulling rancher/agent:v1.2.2 image.”  
> time=“2017-04-29T16:22:10Z” level=info msg=“Container created for machine” containerId=857e2898a42478793c1612dca32a9b74e29ec88410d2b14716d56362cb88776d machineId=1ph6 resourceId=1ph6  
> time=“2017-04-29T16:23:10Z” level=error msg=“Failed to find rancher-agent container” machineId=1ph6 resourceId=1ph6  
> time=“2017-04-29T16:23:10Z” level=error msg=“Error processing event” err=“Failed to find rancher-agent container” eventId=69b1aadd-deef-4f5a-9b90-92c447b7b8e4 eventName=“physicalhost.bootstrap;handler=goMachineService” resourceId=1ph6  
> 2017-04-29 16:23:10,737 ERROR [73c8645c-071b-4fa7-80b1-eba4213c3b04:160] [physicalHost:6] [physicalhost.bootstrap] [ecutorService-6] [c.p.e.p.i.DefaultProcessInstanceImpl] Agent error for [physicalhost.bootstrap.reply;handler=goMachineService]: Failed to find rancher-agent container  
> 2017-04-29 16:23:10,741 ERROR [:] [ecutorService-6] [.e.s.i.ProcessInstanceDispatcherImpl] Agent error for [physicalhost.bootstrap.reply;handler=goMachineService]: Failed to find rancher-agent container  
> 2017-04-29 16:23:11,324 ERROR [9f99e5d7-0586-476a-9912-8cef0f608a4e:161] [host:6] [host.provision] [cutorService-11] [c.p.e.p.i.DefaultProcessInstanceImpl] Unknown exception io.cattle.platform.util.exception.ExecutionException: Failed to find rancher-agent container  
> at io.cattle.platform.process.host.HostProvision.handle(HostProvision.java:77) ~[cattle-iaas-logic-0.5.0-SNAPSHOT.jar:na]  
> at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl.runHandler(DefaultProcessInstanceImpl.java:470) [cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]  
> at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl$4.execute(DefaultProcessInstanceImpl.java:421) ~[cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]  
> at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl$4.execute(DefaultProcessInstanceImpl.java:415) ~[cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]  
> at io.cattle.platform.engine.idempotent.Idempotent.execute(Idempotent.java:42) ~[cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]  
> …

Can anyone tell me where to go from here? Should I just set up hosts with “Custom” provisioning?

---

<div class="post-metadata">

**Author:** ![SteveAtInlet](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@SteveAtInlet](https://forums.suse.com/u/SteveAtInlet)\
**Post date:** [April 29, 2017, 9:54pm UTC](https://forums.suse.com/t/getting-failure-when-adding-ec2-host/6271/2 "2017-04-29T21:54:21Z")

</div>

I’ve gone on and manually created a couple of hosts. It’s so darn easy that I realize now that it doesn’t make much difference if I do it this way. In fact, this way, I can run Centos 7, which I’m more familiar with. I followed the instructions for the Generic host addition, and my hosts popped right up on the Hosts screen looking healthy.

So while launching hosts via AWS is snot something I figured out how to make work, I no longer really care that I didn’t.

---

<div class="post-metadata">

**Author:** ![firelyu](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@firelyu](https://forums.suse.com/u/firelyu)\
**Post date:** [July 22, 2017, 1:37pm UTC](https://forums.suse.com/t/getting-failure-when-adding-ec2-host/6271/3 "2017-07-22T13:37:06Z")

</div>

I face the same issue, and I have resolved it.

1. Add the DNS record
2. Set the `Host Registration URL` as `http://rancher.xxx.com:8080`.
3. Run the docker run in the new host.

```auto
$ sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.5 http://rancher.xxx.com:8080/v1/scripts/xxxxx:yyyyyyyyyy

```
