How do I resolve "Net::OpenTimeout" errors in CodeDeploy?

2 minute read
0

I want to launch a Windows Amazon Machine Image (AMI) instance in AWS CodeDeploy. However, I receive the following error in my AWS CodeDeploy agent log file: "CodeDeploy Instance Agent Service: error during start or run: Net::OpenTimeout - execution expired - C:/Windows/TEMP/ocrFxxx.tmp/lib/ruby/2.3.0/net/http.rb:880:in 'initialize'."

Short description

For AWS provided Windows Server 2016 AMI instances, EC2Launch statistically sets the metadata or AWS Key Management Service (AWS KMS) routes on the first boot. If you create a custom AMI from these instances, then the routes are captured as part of the OS configuration. Any new instances that you launch from the AMI retain the same routes, regardless of subnet placement.

When launching from a custom AMI, these static routes don't update unless one of the following configurations is true:

  • You use Sysprep for your custom AMI.
  • You schedule the Amazon Elastic Compute Cloud (Amazon EC2) launch initialization tasks before you create the AMI.

When launching from a custom AMI into a different Amazon Virtual Private Cloud (Amazon VPC), subnet, or CIDR block, the following issues occur:

  • Configured routes are no longer valid.
  • The instance can't reach the metadata service or the AWS KMS servers that are required for instance activation.

Resolution

1.    Create a custom AMI in Windows.

2.    Use the custom AMI that you created in step 1 to launch a new instance.

Important: If you're using Sysprep, then use Sysprep after launching your new instance.

3.    Connect to your launched Windows instance.

4.    Log in to Windows PowerShell as an administrator.

5.    In PowerShell, navigate to C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts. Then, enter the following command:

.\InitializeInstance.ps1 -Schedule

6.    Press Enter.

7.    Terminate the instance that you created in step 3. Then, create a new AMI from the instance that you terminated.

8.    Use the new AMI to launch the instance in CodeDeploy.


AWS OFFICIAL
AWS OFFICIALUpdated a year ago
2 Comments

This solution reset the administrator password right?

replied 4 months ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

profile pictureAWS
MODERATOR
replied 4 months ago