How do I resolve "Net::OpenTimeout" errors in CodeDeploy?
Last updated: 2022-03-15
I'm trying to launch a Windows Amazon Machine Image (AMI) instance in AWS CodeDeploy. However, when I try to launch the instance, 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'." How do I resolve this error?
For AWS-provided Windows Server 2016 AMI instances, the metadata or AWS Key Management Service (AWS KMS) routes are set statically on the first boot. If you create a custom AMI from such an instance, these 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.
These static routes won't be updated when launching from a custom AMI, unless one of the following is true:
- You're using Sysprep for your custom AMI.
- The Amazon Elastic Compute Cloud (Amazon EC2) launch initialization tasks were scheduled before you created the AMI.
The following occurs if EC2 instances are launched from such an AMI into a different Amazon Virtual Private Cloud (Amazon VPC), subnet, or CIDR block:
- 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.
Important: If you're using Sysprep, then use Sysprep after launching your new 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:
6. Press Enter.
7. Shut down the instance that you created in step 3. Then, create a new instance from the instance that you shut down.
8. Use the new AMI to launch the instance in CodeDeploy.