How do I resolve "Net::OpenTimeout" errors in CodeDeploy?
Last updated: 2020-04-07
When I try to launch my Windows Amazon Machine Image (AMI) instance, I receive an error similar to the following 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?
When you launch an instance from an AWS-provided Windows Server 2016 AMI, 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 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.
If you launch an EC2 instance from such an AMI into a different Amazon Virtual Private Cloud (Amazon VPC), subnet, or CIDR block, then the following are true:
- 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, 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, and then enter the following:
6. Press Enter.
7. Shut down the instance that you created in step 3, and then create a new instance from the instance that you shut down.
8. Use the new AMI to launch the instance in CodeDeploy.