lib/plugins/aws/deployFunction/index.js/AwsDeployFunction/deployFunction
class AwsDeployFunction:  deployFunction() {
    const artifactFileName = this.provider.naming.getFunctionArtifactName(this.options.function);
    let artifactFilePath =
      this.serverless.service.package.artifact || path.join(this.packagePath, artifactFileName);

    // check if an artifact is used in function package level
    const functionObject = this.serverless.service.getFunction(this.options.function);
    if (_.has(functionObject, ['package', 'artifact'])) {
      artifactFilePath = functionObject.package.artifact;
    }

    const data = fs.readFileSync(artifactFilePath);

    const remoteHash = this.serverless.service.provider.remoteFunctionData.Configuration.CodeSha256;
    const localHash = crypto
      .createHash('sha256')
      .update(data)
      .digest('base64');

    if (remoteHash === localHash && !this.options.force) {
      this.serverless.cli.log('Code not changed. Skipping function deployment.');
      return BbPromise.resolve();
    }

    const params = {
      FunctionName: this.options.functionObj.name,
      ZipFile: data,
    };

    const stats = fs.statSync(artifactFilePath);
    this.serverless.cli.log(
      `Uploading function: ${this.options.function} (${filesize(stats.size)})...`
    );

    return this.provider.request('Lambda', 'updateFunctionCode', params).then(() => {
      this.serverless.cli.log(`Successfully deployed function: ${this.options.function}`);
    });
  }