Linked Questions

Popular Questions

I have tried all troubleshooting in this question to no avail.

"UserData": {
                    "Fn::Base64": {
                        "Fn::Join": [
                            "",
                            [
                                "<powershell>\n",
                                "New-Item C:\\Temp\\test.txt -ItemType file \n",
                                "</powershell>\n",
                                "<persist>true</persist>"
                            ]
                        ]
                    }
                }

test.txt file doesnt get created in the C:\Temp folder.

C:\ProgramData\Amazon\EC2-Windows\Launch\Log\UserdataExecution.log:

2018/01/19 02:26:55Z: Userdata execution begins
2018/01/19 02:26:55Z: Zero or more than one <persist> tag was not provided
2018/01/19 02:26:55Z: Unregistering the persist scheduled task
2018/01/19 02:27:18Z: Zero or more than one <runAsLocalSystem> tag was not provided
2018/01/19 02:27:18Z: Zero or more than one <script> tag was not provided
2018/01/19 02:27:19Z: Zero or more than one <powershellArguments> tag was not provided
2018/01/19 02:27:19Z: <powershell> tag was provided.. running powershell content
2018/01/19 07:49:57Z: Userdata execution begins
2018/01/19 07:49:57Z: Failed to get metadata: The result from http://169.254.169.254/latest/user-data was empty
2018/01/19 07:50:00Z: Unable to execute userdata: Userdata was not provided
2018/01/19 07:50:00Z: Userdata execution done

But i can see the script at http://169.254.169.254/latest/user-data

<powershell>
New-Item C:\Temp\test.txt -ItemType file 
</powershell>
<persist>true</persist>

Related Questions