I've got problem that I could not connect and access my EC2 with SSH and showed connection timeout. Once I've created EC2, I can connect and access. Later 3 mins, I could not connect and access it. Please let me know how to solve that issue?

[    7.540187] cloud-init[1047]: Cloud-init v. 17.1 running 'init' at Wed, 20 Dec 2017 08:53:52 +0000. Up 7.27 seconds.
[    7.548824] cloud-init[1047]: ci-info: ++++++++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++++++++
[    7.560826] cloud-init[1047]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+
[    7.572244] cloud-init[1047]: ci-info: | Device |  Up  |           Address           |      Mask     | Scope |     Hw-Address    |
[    7.580877] cloud-init[1047]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+
[    7.592982] cloud-init[1047]: ci-info: |  eth0  | True |        | |   .   | 06:0c:2a:5e:5b:be |
[    7.604832] cloud-init[1047]: ci-info: |  eth0  | True | fe80::40c:2aff:fe5e:5bbe/64 |       .       |  link | 06:0c:2a:5e:5b:be |
[    7.616448] cloud-init[1047]: ci-info: |   lo   | True |          |   |   .   |         .         |[[0;32m  OK  [0m] Started Initial cloud-init job (metadata service crawler).
[    7.625744] cloud-init[1047]: ci-info: |   lo   | True |           ::1/128           |       .       |  host |         .         |
[[0;32m  OK  [0m] Reached target Cloud-config availability.
[[0;32m  OK  [0m
[    7.636537] cloud-init[1047]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+] Reached target Network is Online.
         Starting iSCSI initiator daemon (iscsid)...
[[0;32m  OK  [0m] Reached target System Initialization.
[    7.648807] cloud-init[1047]: ci-info: +++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
[[0;32m  OK  [0m] Listening on UUID daemon activation socket.
[    7.657063] cloud-init
[[0;32m  OK  [0m] Listening on ACPID Listen Socket.
[1047]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+
[[0;32m  OK  [0m] Started Timer to automatically refresh installed snaps.
[    7.672702] cloud-init[1047]: [[0;32m  OK  [0m] Started Daily Cleanup of Temporary Directories.
         Starting Socket activation for snappy daemon.ci-info: | Route | Destination |   Gateway   |    Genmask    | Interface | Flags |
[    7.684164] cloud-init[1047]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+

[[0;32m  OK  [0m] Started Daily apt download activities.
[[0;32m  OK  [0m] Started Daily apt upgrade and clean activities.
[[0;32m  OK  [0m] Reached target Timers.[    7.696431] cloud-init[1047]: ci-info: |   0   |   | |    |    eth0   |   UG  |
[    7.700455] cloud-init[1047]: ci-info: |   1   | |   | |    eth0   |   U   |

         Starting LXD - unix socket.
[[0;32m  OK  [0m] Listening on D-Bus System Message Bus Socket.
[    7.705061] cloud-init[1047]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+
[[0;32m  OK  [0m] Started ACPI Events Check.
[[0;32m  OK  [0m] Reached target Paths.
[[0;32m  OK  [0m] Listening on Socket activation for snappy daemon.
[[0;32m  OK  [0m] Listening on LXD - unix socket.
[[0;32m  OK  [0m] Started iSCSI initiator daemon (iscsid).
         Starting Login to default iSCSI targets...
[[0;32m  OK  [0m] Reached target Sockets.
[[0;32m  OK  [0m] Reached target Basic System.
         Starting LSB: MD monitoring daemon...
         Starting LXD - container startup/shutdown...
[[0;32m  OK  [0m] Started ACPI event daemon.
         Starting Snappy daemon...
[[0;32m  OK  [0m] Started Unattended Upgrades Shutdown.
         Starting /etc/rc.local Compatibility...
         Starting LSB: Record successful boot for GRUB...
[[0;32m  OK  [0m] Started Regular background program processing daemon.
         Starting A high performance web server and a reverse proxy server...
[[0;32m  OK  [0m] Started D-Bus System Message Bus.
         Starting Apply the settings specified in cloud-config...
[[0;32m  OK  [0m] Started FUSE filesystem for LXC.
[[0;32m  OK  [0m] Started Deferred execution scheduler.
         Starting System Logging Service...
         Starting Login Service...
         Starting Accounts Service...
         Starting OpenBSD Secure Shell server...
[[0;32m  OK  [0m] Started LXD - container startup/shutdown.
[[0;32m  OK  [0m] Started /etc/rc.local Compatibility.
[[0;32m  OK  [0m] Started Login to default iSCSI targets.
[[0;32m  OK  [0m] Started LSB: MD monitoring daemon.
[[0;32m  OK  [0m] Started OpenBSD Secure Shell server.
[[0;32m  OK  [0m] Started Snappy daemon.
[[0;32m  OK  [0m] Started LSB: Record successful boot for GRUB.
[[0;32m  OK  [0m] Started A high performance web server and a reverse proxy server.
[[0;32m  OK  [0m] Started Login Service.
         Starting Authenticate and Authorize Users to Run Privileged Tasks...
[[0;32m  OK  [0m] Reached target Remote File Systems (Pre).
[[0;32m  OK  [0m] Reached target Remote File Systems.
         Starting LSB: Set the CPU Frequency Scaling governor to "ondemand"...
         Starting LSB: automatic crash report generation...
         Starting Permit User Sessions...
         Starting LSB: daemon to balance interrupts for SMP systems...
[[0;32m  OK  [0m] Started Permit User Sessions.
[[0;32m  OK  [0m] Started Authenticate and Authorize Users to Run Privileged Tasks.
[[0;32m  OK  [0m] Started Accounts Service.
         Starting Hold until boot process finishes up...
         Starting Terminate Plymouth Boot Screen...
[[0;32m  OK  [0m] Started LSB: Set the CPU Frequency Scaling governor to "ondemand".
[[0;32m  OK  [0m] Started LSB: automatic crash report generation.
[[0;32m  OK  [0m] Started Hold until boot process finishes up.
[[0;32m  OK  [0m] Started Terminate Plymouth Boot Screen.
[[0;32m  OK  [0m] Started Getty on tty1.
[[0;32m  OK  [0m] Started Serial Getty on ttyS0.
[[0;32m  OK  [0m] Reached target Login Prompts.
         Starting Set console scheme...
[[0;32m  OK  [0m] Started LSB: daemon to balance interrupts for SMP systems.
[[0;32m  OK  [0m] Started Set console scheme.
[    8.617050] cloud-init[1147]: Cloud-init v. 17.1 running 'modules:config' at Wed, 20 Dec 2017 08:53:53 +0000. Up 8.52 seconds.
[[0;32m  OK  [0m] Started Apply the settings specified in cloud-config.
  • 1
    (1) Have you contacted support? – Ryder Dec 20 '17 at 8:07
  • (2) Have you attempted to check the console output? – Ryder Dec 20 '17 at 8:08
  • (3) Can you list any details at all that would give anyone the chance to help you? Which AMI? Which OS? What did you do the first time you logged in? – Ryder Dec 20 '17 at 8:10
  • (4) What is your local network topology like? Are you on a restaurant’s WiFi, at work with a stable network, or at home? – Ryder Dec 20 '17 at 8:13
  • This question is very much like asking “oh hey, my car was working this morning, but right now I can’t start it. Can anybody help tell me why?” No, no we can’t. Because there are too many possibilities with that little information. – Ryder Dec 20 '17 at 8:16

From what I see and am experienced in, the private key is not accepted or has wrong access writes. Try to set up the connection using the following guides.



| improve this answer | |

Your best bet is to give it 20 minutes and try again, and double-check the console output. You could very well have discovered a cloud-init bug that's applying a config change or package upgrade sequence following the initial boot and causing an interruption for a while. On occasion when something like this happens, the released AMI configuration is attempting to update the OS on boot or "reaching out" for remote instructions to complete its initial configuration. If this is the case, you'll need to wait for those processes to complete until it's done and SSH is available again.

Things to try to test this scenario explicitly: start a fresh image, log in while you can, leave it open and see if that session is killed by the server. Attempt to log in separately after three minutes; if the first session isn't killed use that one to troubleshoot what's going on. If it was killed, try waiting about 30 minutes (assuming it's a t2.micro instance) and try again.

Also confirm that your Network ACLs are actually passing traffic out correctly, as well as the security group your instance is using. Your instance will almost certainly attempt to contact the internet while its initializing, which means any failure to reach DNS (outgoing UDP traffic) will delay the initialization procedure and make post-boot configuration crawl as each procedural step waits to time out before moving on to the next step.

If after 30 minutes your instance is still unavailable, there's a slim chance that stopping and then starting the image again will help (cloud-init I believe won't run on reboot, as it's already initialized).

Otherwise, you'd need to

  1. launch an image you know is working in the same availability zone,
  2. confirm you can reach that
  3. and then stop it,
  4. shut down or stop the one that wasn't working
  5. and detach its volume;
  6. you can then attach the volume from the non-working volume as an extra disk on the working instance,
  7. start the working instance again,
  8. log into the working instance,
  9. and then mount the disk from the failed instance and inspect its logs and configuration manually.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.