aws-sdk-google-apps
Native Google Apps Script support for Amazon AWS SDK for JavaScript
AI Summary
AWS SDK for Google Apps Script
Enables native AWS SDK usage in Google Apps Script.
Target Users
GAS developers who want to integrate AWS services like S3, SES, Lambda, EC2.
Problems Solved
Lack of native full AWS SDK support for all services in Google Apps Script.
Script ID
- In GAS Editor: Click "Libraries +" → Paste into "Script ID" field → Click "Look up"
- "aws-sdk-google-apps" will appear in the search results
- Select the latest version (highest number) from "Version" dropdown
- Click "Add"
Tags
Main Features
1
Full AWS SDK
Native support for entire AWS SDK in GAS, including SES, S3, Lambda, EC2.
2
Easy Library Deployment
Add library via Script ID, init config with initConfig for immediate use.
3
Direct SDK Access
Direct access to AWS SDK methods via AWSLIB.AWS.Service objects.
Examples
Main Functions
| Function | Description |
|---|---|
| AWSLIB.initConfig | Initialize AWS config |
| AWSLIB.getS3Object | Retrieve S3 object |
| AWSLIB.AWS.S3 | Create S3 client |
Examples
S3 Object Retrieval Example
/**
* S3オブジェクト取得例
* ・AWS設定初期化: AWSLIB.initConfig(AWS_CONFIG)
* ・S3オブジェクト取得: AWSLIB.getS3Object('myBucket', 'folder1/file.jpg')
* ・結果Blob化: Utilities.newBlob(result.Body, result.ContentType)
*/
async function getS3ObjectTest() {
AWSLIB.initConfig(AWS_CONFIG);
var result = await AWSLIB.getS3Object('myBucket', 'folder1/file.jpg');
if (result === false) {
return false;
}
var blob = Utilities.newBlob(result.Body, result.ContentType);
return blob;
}S3 Service Creation Example
/**
* S3サービスオブジェクト作成例
* ・AWS SDKアクセス: AWSLIB.AWS.S3
* ・クライアント作成: new AWSLIB.AWS.S3({apiVersion: '2006-03-01'})
* ・バケットパラメータ: params: { Bucket: albumBucketName }
*/
function createS3Client(albumBucketName) {
var s3 = new AWSLIB.AWS.S3({
apiVersion: '2006-03-01',
params: { Bucket: albumBucketName },
});
return s3;
}