There are more AWS SDK examples available in the AWS Doc SDK Examples
Policy to grants service-linked role permissions for Compute Optimization Automation
The following code example shows how to This permission-based policy grants service-linked role permissions for Compute Optimization Automation