Lambda URL with x-amz-content-sha256 header

0

Hey guys,

I want to ask can we (from client) create x-amz-content-sha256 then add it to header each time we request to AWS URL? How to implement that solution.

Thank you!!!

profile picture
Bach
asked 13 days ago53 views
1 Answer
0
Accepted Answer

Yes, you can. Do you access your lambda behind a Cloudfront? Check how to restrict user access for Post and Put with the header x-amz-content-sha256: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-lambda.html

If you are using python in your client side, you can use hashlib library.

Example:

import hashlib

payload = b'{"key": "value"}'  # Replace with your actual payload
sha256_hash = hashlib.sha256(payload).hexdigest()

Then you can call the Lambda URL, includes the value sha256_hash in the request header using x-amz-content-sha256.

profile pictureAWS
EXPERT
AmerO
answered 13 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions