Closed amudhanp closed 3 years ago
Thanks for reaching out to us!
When using Session Manager console, there is only one preference that can be applied globally to all the sessions triggered from console and this preference is stored in a SSM document named SSM-SessionManagerRunShell. However different preferences can be used with Start Session requests when triggered from AWS CLI. There are two ways to achieve this.
{
"schemaVersion": "1.0",
"description": "Session Document Example JSON Template",
"sessionType": "Standard_Stream",
"parameters": {
"s3BucketName": {
"type": "String",
"description": "S3 bucket name for uploading session data"
}
},
"inputs": {
"s3BucketName": "{{s3BucketName}}",
"s3KeyPrefix": "",
"s3EncryptionEnabled": true,
"cloudWatchLogGroupName": "",
"cloudWatchEncryptionEnabled": true,
"kmsKeyId": ""
}
}
Above document can be passed when using AWS CLI to make start session request along with the desired value for S3 bucket name. Below is a sample StartSession request.
aws ssm start-session --target <TARGET_ID> --document-name SSM-SessionManagerRunShellCustom --parameters "s3BucketName=<BUCKET_NAME>"
Please follow below guide to create session manager preference document and let us know in case of further queries. https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-create-preferences-cli.html
I have 3 EC2 Instances and I want each instance to write SSM logs to different S3 buckets or folders, In session manager preference it looks global applies to all SSM sessions is there a way to define?