lib/plugins/aws/utils/credentials.js/writeCredentialsContent
const writeCredentialsContent = content =>
  new BbPromise((resolve, reject) =>
    writeFile(
      credentialsFilePath,
      content,
      !isWindows ? { mode: constants.S_IRUSR | constants.S_IWUSR } : null,
      writeFileError => {
        if (writeFileError) {
          if (writeFileError.code === 'ENOENT') {
            mkdir(awsConfigDirPath, !isWindows ? { mode: constants.S_IRWXU } : null, mkdirError => {
              if (mkdirError) reject(mkdirError);
              else resolve(writeCredentialsContent(content));
            });
          } else {
            reject(writeFileError);
          }
        } else {
          resolve();
        }
      }
    )
  );