lib/plugins/aws/configCredentials/awsConfigCredentials.js/AwsConfigCredentials/configureCredentials
class AwsConfigCredentials:  configureCredentials() {
    return BbPromise.try(() => {
      // sanitize
      this.options.provider = this.options.provider.toLowerCase();
      this.options.profile = this.options.profile ? this.options.profile : 'default';

      // resolve if provider option is not 'aws'
      if (this.options.provider !== 'aws') return null;

      // validate
      if (!this.options.key || !this.options.secret) {
        throw new this.serverless.classes.Error(
          'Please include --key and --secret options for AWS.'
        );
      }

      this.serverless.cli.log('Setting up AWS...');

      return credentials.resolveFileProfiles().then(profiles => {
        if (profiles.has(this.options.profile)) {
          // Only update the profile if the overwrite flag was set
          if (!this.options.overwrite) {
            const message = [
              `Failed! ~/.aws/credentials already has a "${this.options.profile}" profile.`,
              ' Use the overwrite flag ("-o" or "--overwrite") to force the update',
            ].join('');
            this.serverless.cli.log(message);
            return null;
          }
        }
        profiles.set(this.options.profile, {
          accessKeyId: this.options.key,
          secretAccessKey: this.options.secret,
        });

        return credentials.saveFileProfiles(profiles);
      });
    });
  }