Serverless File Uploader with AWS HTTP Gateway and S3 - Step by Step Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ม.ค. 2022
  • Lambda Code:
    ------------------------
    import json
    import base64
    import boto3
    client=boto3.client('s3')
    def lambda_handler(event, context):
    TODO implement
    print(event)
    ms=base64.b64decode(event['body'])
    response = client.put_object(
    Body=ms,
    Bucket='demouploadfromapilambda',
    Key='test1.PNG',
    )
    print(response)
    return {
    'statusCode': 200,
    'body': json.dumps('Image uploaded successfully')
    }
    Check this playlist for more AWS Projects in Big Data domain:
    • Demystifying Data Engi...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 14

  • @prateekranjan8085
    @prateekranjan8085 9 หลายเดือนก่อน +1

    Thanks bro, for making it easy!

  • @user-co7op7jz3t
    @user-co7op7jz3t ปีที่แล้ว +1

    simply fabulous

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  ปีที่แล้ว

      Thank you so much for your kind words Mohammed Abu! Happy Learning

  • @kaancukur5312
    @kaancukur5312 9 หลายเดือนก่อน +1

    Thanks bro, you r best amk

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  9 หลายเดือนก่อน

      You are welcome buddy 😊 Happy Learning ✌🏻

  • @madhubhardwaj4512
    @madhubhardwaj4512 ปีที่แล้ว

    Hi Dear, Here Image file name is hard coded. how we can make it dynamic as I don't see any key holding filename. Thanks

    • @jitx2797
      @jitx2797 ปีที่แล้ว

      You can read image file name
      Or you many people prefer random image name from uuid or nanoid

  • @manojt7012
    @manojt7012 2 ปีที่แล้ว +1

    Hi. I was able to successfully upload to S3 but when I download the PNG it is not opening saying as unsupported format

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  2 ปีที่แล้ว +1

      are you uploading jpg file and saving as .png or something ? I mean have you given proper format ?

    • @manojt7012
      @manojt7012 2 ปีที่แล้ว

      @@KnowledgeAmplifier1 yeah I'm uploading .png and saving the key in same .png only but not sure why it is not opening

    • @manojt7012
      @manojt7012 2 ปีที่แล้ว +1

      @@KnowledgeAmplifier1 hey sorry I made some mistake in code. Now I have resolved that.. thanks bro

    • @KnowledgeAmplifier1
      @KnowledgeAmplifier1  2 ปีที่แล้ว

      @@manojt7012 super , Glad to know it's resolved ! Happy Learning :-)

    • @gauravjoshi2982
      @gauravjoshi2982 ปีที่แล้ว +1

      @@manojt7012 hey, I have same problem. so, can you explain me what you did?
      I'm uploading .jpg file and .png file successfully but when i download from s3 bucket it's not accessible.