Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is UserData script placed in a Windows EC2 instance?

Is the UserData part stored anywhere on a Windows EC2 machine? I need to examine it to see that input variables are correct.

On Ubuntu, it's supposed to be stored at /var/lib/cloud/instances/[instance-id]/user-data.txt according to this link.

The user data section in CloudFormation looks like this:

"UserData"         : {
    "Fn::Base64" : {
        "Fn::Join" : [
            "",
            [
                "<script>\n",
                "seedtool.exe ", { "Fn::GetAtt" : [ "DatabaseCluster" , "Endpoint.Address" ] }, "\n",
                "</script>\n"
            ]
        ]
    }
},

I need to see the user-data.txt so I can see what { "Fn::GetAtt" : [ "DatabaseCluster" , "Endpoint.Address" ] } resolves to.

like image 280
sashoalm Avatar asked Jul 17 '26 10:07

sashoalm


1 Answers

For anyone looking for the actual location of the userdata script, it should be in:

C:\Windows\System32\config\systemprofile\AppData\Local\Temp\Amazon\EC2-Windows\Launch\InvokeUserData\UserScript.ps1

Note that files in this location (...\AppData\Local\Temp\) may be removed by cleanup processes or tools during the instance's lifetime.

like image 92
TylerW Avatar answered Jul 19 '26 06:07

TylerW



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!