Skip to content

Commit 872f550

Browse files
authored
Document how to collect UserData (#1504)
1 parent e992010 commit 872f550

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

log-collector-script/linux/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,12 @@ aws ssm get-command-invocation \
129129
```
130130

131131
4. Once the above command is executed successfully, the logs should be present in the S3 bucket specified in the previous step.
132+
133+
### Collect User Data
134+
135+
If collecting user data is required as apart of troubleshooting please use the commands below to retrieve data via IMDSv2:
136+
137+
```
138+
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
139+
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/user-data
140+
```

log-collector-script/windows/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,12 @@ aws ssm get-command-invocation \
121121
```
122122

123123
4. Once the above command is executed successfully, the logs should be present in the S3 bucket specified in the previous step.
124+
125+
### Collect User Data
126+
127+
If collecting use rdata is required as apart of troubleshooting please use the commands below to retrieve data via IMDSv2:
128+
129+
```
130+
[string]$token = Invoke-RestMethod -Headers @{"X-aws-ec2-metadata-token-ttl-seconds" = "21600"} -Method PUT -Uri http://169.254.169.254/latest/api/token
131+
Invoke-RestMethod -Headers @{"X-aws-ec2-metadata-token" = $token} -Method GET -Uri http://169.254.169.254/latest/user-data
132+
```

0 commit comments

Comments
 (0)