2 Answers
- Newest
- Most votes
- Most comments
2
Session logging records information about current and completed sessions in the Systems Manager console. You can also log details about commands run during sessions in your AWS account.
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-logging.html
You can send a continual stream of session data logs to Amazon CloudWatch Logs. Essential details, such as the commands a user has run in a session, the ID of the user who ran the commands, and timestamps for when the session data is streamed to CloudWatch Logs, are included when streaming session data.
0
To help other people with the same issue:
- I found no "AWS built-in" way to use ssh and have logs of all commands
- to keep using ssh and still have logs, the option I found was to use Teleport (https://github.com/gravitational/teleport)
- if you don't need to use the ssh protocol, you can use SSM command line directly (
aws ssm start-session --document-name SSM-SessionManagerRunShell
, you can omit the document-name as it is the default) and it will log the commands like when opening a session from the console (but the person performing it will always have command-line access to the userssm-user
) NB: I didn't find an equivalent for scp in that case, my best lead is to to build one yourself using S3.
answered 9 months ago
Relevant content
- asked a year ago
Thanks for the quick answer, however I've already setup "Stream session logs" on that page and like I said, it only logs commands when starting a session from AWS console. It doesn't log anything when I'm using ssh with a SSM ProxyCommand with document "AWS-StartSSHSession".