CodeDeploy fails with Error: Profile [profile-name] does not exist

Would be possible to configure the AWS CodeDeploy to run sls deploy --stage prod without using the profile set in the serverless.yml?

Right now my CodeDeploy is failing with the error: Error: Profile w4-serverless does not exist because the profile won’t exist in the container that runs the deploy command.

Yes. You’d need to set your AWS creds in the environment variables of your codeBuild instance

export AWS_ACCESS_KEY_ID=<your-key-here>
export AWS_SECRET_ACCESS_KEY=<your-secret-key-here>

Isn’t that insecure?