g. Attach an IAM Role to Lambda

The IAM changes you are conducting here with the AWS CLI can also be done using AWS CloudFormation like in section b or with the AWS Console. There are always multiple options for you to interest with services in the cloud. Feel free to explore them.

Remember the bucket you created in section b? you will need its name for the following steps.

By default, AWS Lambda create an execution role with permissions to upload logs to Amazon CloudWatch Logs. You can customize this default role later when adding triggers. In this case you will add an additional Policy to this role for the Lambda function to execute the scheduler (Slurm) commands using AWS Systems Manager (SSM).