1

I m trying to create batch operation on s3 objects that is delete object tagging but i gives me method not allow against this resourse Here is my serverless lambda function code (typescript)

 let s3 = new AWS.S3Control({
      region: "us-east-1",
     endpoint: 'https://s3.amazonaws.com/',
      accessKeyId: `${event.queryStringParameters.AccessKeyID}`,
      secretAccessKey: `${event.queryStringParameters.SecretAccessKey}`,
    });
    
    let params: any = event.body;

    let id = await s3.createJob(params).promise();
    return formatJSONResponse({
      id,
    }, 200);
  } catch (error) {

    return formatJSONResponse({
      message: error.code,
      error: error,
    }, error.statusCode);

  }

Request body from postman

Response Response

  • are you trying to delete tags on a specific bucket or all s3 buckets? – Jatin Mehrotra Feb 01 '22 at 08:27
  • delete tags on s3 specific bucket objects – shahid abbas Feb 01 '22 at 08:48
  • attach this bucket policy to your bucket and then try `{ "Id": "Policy1643703926320", "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1643703923314", "Action": [ "s3:DeleteObjectTagging" ], "Effect": "Allow", "Resource": "arn:aws:s3:::${BucketName}/${KeyName}.", "Principal": "*" } ] }` – Jatin Mehrotra Feb 01 '22 at 11:16
  • ("Resource": "arn:aws:s3:::${BucketName}/${KeyName}." ) what does keyName mean ? – shahid abbas Feb 01 '22 at 13:32
  • keyname here means the name of object, if it applies to all object you can use wildcard as *, example `arn:aws:s3:::DOC-EXAMPLE-BUCKET/*` – Jatin Mehrotra Feb 01 '22 at 16:28

0 Answers0