You can now use AWS Secrets Manager to pass credentials to AWS CodeBuild build jobs. This can be achieved by specifying the secrets directly in your buildspec or as an environment variable in your CodeBuild Project.
Secrets Manager helps you protect secrets needed to access your applications, services, and IT resources. With Secrets Manager, you can rotate, manage, and retrieve database credentials, API keys, and other secrets throughout their lifecycle.
from Recent Announcements https://aws.amazon.com/about-aws/whats-new/2019/11/aws-codebuild-adds-support-for-aws-secrets-manager/