습관제작소

23-01-31 AWS(Lambda) #10 본문

SMHRD or ITSchool/IoT. AWS

23-01-31 AWS(Lambda) #10

KUDO 2023. 1. 31. 11:25

람다의 개요

람다 이벤트 생성

람다 s3 연결

람다 s3 저장소 읽기

  • 방법은 같으나 코드만 변경

    import json 
    import boto3 
    import botocore 
    BUCKET_NAME = 'mykudo' 
    KEY = 'testKey2.txt' 
    s3_client = boto3.client('s3') 
def lambda\_handler(event, context):  
data = s3\_client.get\_object(Bucket=BUCKET\_NAME, Key=KEY)  
content = data\['Body'\].read()  
print(content)  
return {  
'statusCode': 200,  
'body': json.dumps(content.decode('UTF-8'))  
}

'SMHRD or ITSchool > IoT. AWS' 카테고리의 다른 글

23-01-30 AWS(Lightsail) #9  (0) 2023.01.30
23-01-26 AWS(ELB, DNS 라운드로빈방식) #8  (0) 2023.01.26
23-01-25 AWS(PHP 실습) #7-2  (0) 2023.01.25
23-01-25 AWS(PHP 실습) #7-1  (0) 2023.01.25
23-01-19 AWS(DBserver 만들기) #6  (0) 2023.01.25
Comments