Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check if s3 bucket exists in lambda

// import or require aws-sdk as AWS
// const AWS = require('aws-sdk');

const checkBucketExists = async bucket => { 
  const s3 = new AWS.S3();
  const options = {
    Bucket: bucket,
  };
  try {
    await s3.headBucket(options).promise();
    return true;
  } catch (error) {
    if (error.statusCode === 404) {
      return false;
    }
    throw error;
  }
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: js get each pair of values from an array of objects 
Javascript :: Reduce array to a single string using reduce 
Javascript :: Get the current tab 
Javascript :: @click vue target 
Javascript :: keycloak api get an user by exact username 
Javascript :: javascript continue with for Loop 
Javascript :: angular disable select dropdown 
Javascript :: javascript press tab key 
Javascript :: jquery multiple ids same function 
Javascript :: page reload detect in jquery 
Javascript :: change terminal shortcut vscode 
Javascript :: nextjs react native web typescript 
Javascript :: removeitem localstorage 
Javascript :: vuejs set default value for prop 
Javascript :: scroll for sticky 
Javascript :: sum of all elements in array javascript 
Javascript :: es6 array to object keys 
Javascript :: javascript object lookups 
Javascript :: redux toolkit how to set empty initial state 
Javascript :: bootstrap 5 with next js 
Javascript :: javascript slice method 
Javascript :: node schedule every minute 
Javascript :: js innerhtml 
Javascript :: react algolia range slider 
Javascript :: fetch method post handing the post add on php 
Javascript :: nodejs heap usage 
Javascript :: display for sometime only session flash message in laravel with javascript 
Javascript :: to the power of javascript 
Javascript :: first letter string uppercase javascript 
Javascript :: how to get data-target value in jquery 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =