AWS Cloudfront Create Invalidations - Authentification

Dear n8n Community,

I am working on a workflow to create a Invalidation on AWS Cloudfront via HTTP Node.

I have no idea how to authenticate with the HTTP Request Node.

I suppose it is a header Authentification, but the format is not similar to any I have seen before.

Does Anyone has a clue how to do it?

The Code to make invalidations via XML then should be clear I guess:

POST https://cloudfront.amazonaws.com/2020-05-31/distribution/"DistributionID"/invalidation

with following body:

<InvalidationBatch xmlns="http://cloudfront.amazonaws.com/doc/2020-05-31/">
   <CallerReference>string</CallerReference>
   <Paths>
      <Items>
         <Path>string</Path>
      </Items>
      <Quantity>integer</Quantity>
   </Paths>
</InvalidationBatch>

Hi @prononext, any chance you can use existing AWS credentials here? The HTTP Request node would support this through the “Predefined Credential Type” option:

image

Has anyone managed to get Cloudfront API working on a http Request node?
On every single API call I make I get the following error:

{
“status”:“rejected”,
“reason”:{
“context”:{
},
“name”:“NodeApiError”,
“timestamp”:1674056590203,
“node”:{
“parameters”:{…}, // 9 items
“id”:“bce01560-4fc0-4eae-564e-91af308a3872”,
“name”:“HTTP Request1”,
“type”:“n8n-nodes-base.httpRequest”,
“typeVersion”:3,
“position”:[…], // 2 items
“credentials”:{…} // 1 items
},
“httpCode”:null,
“description”:“Cannot read properties of undefined (reading ‘replace’)”
}
}

Every other call to AWS using the other nodes is working without any problems.

In Postman it is working perfectly when I select “AWS Signature” as credentials and enter the same keys I use with other aws service successfully in n8n.

The difference is that Postman has a “Service Name” field and the calls only work if I put in “cloudfront”.

This kind of scope I cannot see in the n8n credentials, there are only predefined checkboxes and no way to set a service name:

image

I tried to configure the Signature Authorization Header for AWS Signature Auth but had no success.

Maybe there is a way to manipulate the AWS Credential type to make that kind of custom calls possible?

Hi @prononext, if you have AWS credentials set up you can use them in your HTTP Request node like so:

This is assuming you are using the current version of [email protected]. If you are having any issues with this it’d be great if you could open a new thread with the respective details requested in the template.

Yes I have setup the HTTP Request node like you mentioned with the AWS credentials and I am on 0.211.2.

All respective details of the API Call are in this thread, there is just one node like mentioned in the first post.

After a lot of testing around with only failure I decided to run a dockerized aws-cli in my n8n stack to get all the missing functionality.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.