'AWS EC2 instance not able to execute user data script
I am trying to get the aws user data to download a powershell script from S3 bucket and then run it on the EC2 instance after the instance has already been built.
I put following into the user data of the EC2 instance but even the "C:\Temp" folder is not getting created, and of course the script doesn't get downloaded or run:-
<powershell>
New-Item -Path "C:\Temp" -ItemType directory -Force
aws s3api get-object --bucket bucket1 --key Script.ps1 c:\temp\Script.ps1
c:\temp2\Script.ps1
</powershell>
<persist>true</persist>
If I go to http://169.254.169.254/latest/user-data/ within the EC2 instance then I can see the above lines of code.
Please let me know what is required to fix it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
