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 deletes = await s3.deleteObject(
{
Bucket:'test-bucket', // 存在するバケット
Key:'test/sample.json' // 存在しないファイル
}).promise().catch(err=>{
throw new Error(err) // test/sample.jsonが存在しなくてもcatch句には入らない
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment