メインコンテンツにスキップ

aws-sdk-google-apps

Native Google Apps Script support for Amazon AWS SDK for JavaScript

AI Summary

AWS SDK for Google Apps Script

Provides a lightweight SDK that enables Google Apps Script to call various AWS service APIs easily.

Target Users

Intermediate or advanced Google Apps Script developers who need to operate AWS from Google Workspace

Problems Solved

Apps Script lacks built-in AWS Signature V4 and the Node.js AWS SDK, making direct AWS access cumbersome.

Tags

Main Features

1
Built-in Signature V4

Implements AWS Signature V4 so developers don’t have to hand-code authentication.

2
GAS-optimised Lightweight SDK

A trimmed-down AWS SDK fits within Apps Script size limits by excluding unneeded modules.

3
Familiar AWS SDK Interface

Keeps an interface similar to AWS SDK v2 for Node.js, easing code reuse and learning.

Usage Examples

List objects in an S3 bucket

/**
 * Calls S3 listObjects API and logs file names in the bucket.
 * Make sure the “aws-sdk-google-apps” library is added to your project first.
 */
function listS3Objects() {
  // Load the SDK
  const AWS = AwsSdk.load();

  // Set credentials
  AWS.config.update({
    accessKeyId: 'YOUR_ACCESS_KEY_ID',
    secretAccessKey: 'YOUR_SECRET_ACCESS_KEY',
    region: 'us-east-1',
  });

  // Create S3 client
  const s3 = new AWS.S3();

  // Define parameters
  const params = {
    Bucket: 'your-bucket-name',
  };

  // Retrieve object list
  const response = s3.listObjects(params);

  // Log result
  Logger.log(JSON.stringify(response, null, 2));
}

Copy the snippet into an Apps Script project, replace credentials and bucket name, then run the function to see it work.