Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const AWS = require('aws-sdk');
const s3 = new AWS.S3({'region':'ap-southeast-1'});
AWS.config.update({region: 'ap-southeast-1'});
exports.handler = async (event) => {
const params = {
Bucket:'test-bucket',
Key:'dir1/subdir1/sample.json',
Body: JSON.stringify({name: 'takahashi', age: 50},undefined,1),
ContentType: 'application/json'
}
const json = await s3.putObject(params).promise().catch(err=>{
throw new Error(`エラー`)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment