Batch load from S3 - fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden











up vote
0
down vote

favorite












Apologies if I am not explaining this correctly as I am new to AWS. I have a file in an S3 bucket that has brackets in the name. We are using S3, Lambda and Batch to transfer the data over to a SQL database.



If I manually set Batch to load the file, it works okay. If I set up Lambda to see the file when it drops into S3 then it seems to see the file with % signs instead of the brackets. If I amend the upload handler to accept % in the name, then the batch file fails with:



fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden



As I know we can connect okay to the S3 bucket, I am assuming this is not permissions but may be the fact that the name that Lambda sees does not actually exist (i.e. TestLoad_(file1).csv comes across as TestLoad_%28file1%29.csv).



Has anyone come across this and how would I fix it (other than manually rename the file every time it drops into S3).










share|improve this question






















  • What language is your Lambda function written in?
    – Michael - sqlbot
    Nov 8 at 17:29










  • Hi Michael - it's in Python
    – Caz
    Nov 9 at 7:30










  • S3 event notifications contain the object key in S3's somewhat strange internal representation -- essentially query-string encoded, presumably an artifact of a very old and unfortunate design decision that it's too late to fix without breaking different things. You have to decode it before using it, including using it to do other things with S3. Check stackoverflow.com/a/39465221/1695906
    – Michael - sqlbot
    Nov 9 at 12:32















up vote
0
down vote

favorite












Apologies if I am not explaining this correctly as I am new to AWS. I have a file in an S3 bucket that has brackets in the name. We are using S3, Lambda and Batch to transfer the data over to a SQL database.



If I manually set Batch to load the file, it works okay. If I set up Lambda to see the file when it drops into S3 then it seems to see the file with % signs instead of the brackets. If I amend the upload handler to accept % in the name, then the batch file fails with:



fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden



As I know we can connect okay to the S3 bucket, I am assuming this is not permissions but may be the fact that the name that Lambda sees does not actually exist (i.e. TestLoad_(file1).csv comes across as TestLoad_%28file1%29.csv).



Has anyone come across this and how would I fix it (other than manually rename the file every time it drops into S3).










share|improve this question






















  • What language is your Lambda function written in?
    – Michael - sqlbot
    Nov 8 at 17:29










  • Hi Michael - it's in Python
    – Caz
    Nov 9 at 7:30










  • S3 event notifications contain the object key in S3's somewhat strange internal representation -- essentially query-string encoded, presumably an artifact of a very old and unfortunate design decision that it's too late to fix without breaking different things. You have to decode it before using it, including using it to do other things with S3. Check stackoverflow.com/a/39465221/1695906
    – Michael - sqlbot
    Nov 9 at 12:32













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Apologies if I am not explaining this correctly as I am new to AWS. I have a file in an S3 bucket that has brackets in the name. We are using S3, Lambda and Batch to transfer the data over to a SQL database.



If I manually set Batch to load the file, it works okay. If I set up Lambda to see the file when it drops into S3 then it seems to see the file with % signs instead of the brackets. If I amend the upload handler to accept % in the name, then the batch file fails with:



fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden



As I know we can connect okay to the S3 bucket, I am assuming this is not permissions but may be the fact that the name that Lambda sees does not actually exist (i.e. TestLoad_(file1).csv comes across as TestLoad_%28file1%29.csv).



Has anyone come across this and how would I fix it (other than manually rename the file every time it drops into S3).










share|improve this question













Apologies if I am not explaining this correctly as I am new to AWS. I have a file in an S3 bucket that has brackets in the name. We are using S3, Lambda and Batch to transfer the data over to a SQL database.



If I manually set Batch to load the file, it works okay. If I set up Lambda to see the file when it drops into S3 then it seems to see the file with % signs instead of the brackets. If I amend the upload handler to accept % in the name, then the batch file fails with:



fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden



As I know we can connect okay to the S3 bucket, I am assuming this is not permissions but may be the fact that the name that Lambda sees does not actually exist (i.e. TestLoad_(file1).csv comes across as TestLoad_%28file1%29.csv).



Has anyone come across this and how would I fix it (other than manually rename the file every time it drops into S3).







amazon-web-services amazon-s3






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 8 at 13:34









Caz

11




11












  • What language is your Lambda function written in?
    – Michael - sqlbot
    Nov 8 at 17:29










  • Hi Michael - it's in Python
    – Caz
    Nov 9 at 7:30










  • S3 event notifications contain the object key in S3's somewhat strange internal representation -- essentially query-string encoded, presumably an artifact of a very old and unfortunate design decision that it's too late to fix without breaking different things. You have to decode it before using it, including using it to do other things with S3. Check stackoverflow.com/a/39465221/1695906
    – Michael - sqlbot
    Nov 9 at 12:32


















  • What language is your Lambda function written in?
    – Michael - sqlbot
    Nov 8 at 17:29










  • Hi Michael - it's in Python
    – Caz
    Nov 9 at 7:30










  • S3 event notifications contain the object key in S3's somewhat strange internal representation -- essentially query-string encoded, presumably an artifact of a very old and unfortunate design decision that it's too late to fix without breaking different things. You have to decode it before using it, including using it to do other things with S3. Check stackoverflow.com/a/39465221/1695906
    – Michael - sqlbot
    Nov 9 at 12:32
















What language is your Lambda function written in?
– Michael - sqlbot
Nov 8 at 17:29




What language is your Lambda function written in?
– Michael - sqlbot
Nov 8 at 17:29












Hi Michael - it's in Python
– Caz
Nov 9 at 7:30




Hi Michael - it's in Python
– Caz
Nov 9 at 7:30












S3 event notifications contain the object key in S3's somewhat strange internal representation -- essentially query-string encoded, presumably an artifact of a very old and unfortunate design decision that it's too late to fix without breaking different things. You have to decode it before using it, including using it to do other things with S3. Check stackoverflow.com/a/39465221/1695906
– Michael - sqlbot
Nov 9 at 12:32




S3 event notifications contain the object key in S3's somewhat strange internal representation -- essentially query-string encoded, presumably an artifact of a very old and unfortunate design decision that it's too late to fix without breaking different things. You have to decode it before using it, including using it to do other things with S3. Check stackoverflow.com/a/39465221/1695906
– Michael - sqlbot
Nov 9 at 12:32

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208837%2fbatch-load-from-s3-fatal-error-an-error-occurred-403-when-calling-the-heado%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208837%2fbatch-load-from-s3-fatal-error-an-error-occurred-403-when-calling-the-heado%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Schultheiß

Verwaltungsgliederung Dänemarks

Liste der Kulturdenkmale in Wilsdruff