Skip to content

Commit

Permalink
Document how to collect UserData (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondceausu authored Nov 15, 2023
1 parent e992010 commit 872f550
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions log-collector-script/linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,12 @@ aws ssm get-command-invocation \
```

4. Once the above command is executed successfully, the logs should be present in the S3 bucket specified in the previous step.

### Collect User Data

If collecting user data is required as apart of troubleshooting please use the commands below to retrieve data via IMDSv2:

```
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/user-data
```
9 changes: 9 additions & 0 deletions log-collector-script/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,12 @@ aws ssm get-command-invocation \
```

4. Once the above command is executed successfully, the logs should be present in the S3 bucket specified in the previous step.

### Collect User Data

If collecting use rdata is required as apart of troubleshooting please use the commands below to retrieve data via IMDSv2:

```
[string]$token = Invoke-RestMethod -Headers @{"X-aws-ec2-metadata-token-ttl-seconds" = "21600"} -Method PUT -Uri http://169.254.169.254/latest/api/token
Invoke-RestMethod -Headers @{"X-aws-ec2-metadata-token" = $token} -Method GET -Uri http://169.254.169.254/latest/user-data
```

0 comments on commit 872f550

Please sign in to comment.