Skip to content

Commit 845c13a

Browse files
dewan-ahmedHarness
authored andcommitted
Update AMI repacking guide (#100003)
* c9cd23 Update AMI repacking guide
1 parent 100d9da commit 845c13a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/continuous-integration/troubleshoot-ci/optimize-windows-vm-runner.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ docker pull harness/drone-git:1.6.3
2020
```
2121
C:\ProgramData\Amazon\EC2Launch\state.run-once
2222
```
23+
:::tip
24+
If `C:\ProgramData\Amazon\EC2Launch\state.run-once` is not found, run the following command instead:
25+
```
26+
C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
27+
```
28+
:::
29+
2330
5. Create a New AMI from the Updated VM.
2431

2532
![Create a new AMI - part A](./static/aws-ec2-a.png)

docs/continuous-integration/use-ci/set-up-build-infrastructure/vm-build-infrastructure/set-up-an-aws-vm-build-infrastructure.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ If you plan to use a custom Windows AMI in your AWS VM build farm, you must dele
102102

103103
In Windows, sysprep checks if `state.run-once` exists at `C:\ProgramData\Amazon\EC2Launch\state.run-once`. If the file exists, sysprep doesn't run post-boot scripts (such as `cloudinit`, which is required for Harness VM build infrastructure). Therefore, you must delete this file from your AMI so it doesn't block the VM init script.
104104

105+
:::tip
106+
If `C:\ProgramData\Amazon\EC2Launch\state.run-once` is not found, run the following command instead:
107+
```
108+
C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
109+
```
110+
:::
111+
105112
If you get an error about an unrecognized `refreshenv` command, you might need to [install Chocolatey](https://chocolatey.org/install) and add it to `$profile` to enable the `refreshenv` command.
106113

107114
### Environment Variables

0 commit comments

Comments
 (0)