일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 전기차충전
- 보안
- everon
- AWS
- esp8266
- flask
- Android
- 에버온
- STM32
- thread
- 서버리스
- 홈어시스턴트
- dynamodb
- 파이썬
- homeassistant
- 플라스크
- raspberry
- 디자인패턴
- YMODEM
- 전기차
- 전기차충전기
- 충전기
- IOT Core
- 완속충전기
- 안드로이드
- 라즈베리파이
- OCPP
- lambda
- 급속충전기
- 펌웨어
Archives
- Today
- Total
Louie NRT Story
[AWS] Lambda for S3 본문
반응형
Download file from S3 and upload this again.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import boto3 import os import sys import urllib s3_client = boto3.client('s3') def handler(event, context): bucket = 'codebuild-oregon-louie0724-output-bucket' key = 'test01.png' raw_key = urllib.parse.unquote_plus(key) download_path = '/tmp/{}'.format(key) upload_path = '/tmp/{}'.format(key) s3_client.download_file(bucket, raw_key, download_path) s3_client.upload_file(upload_path, bucket, 'thumbnail-{}'.format(raw_key)) print("success Upload") | cs |
More Simple programming.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import boto3 import os import sys import urllib s3_client = boto3.client('s3') def handler(event, context): bucket = 'codebuild-oregon-louie0724-output-bucket' key = 'test01.png' #raw_key = urllib.parse.unquote_plus(key) download_path = '/tmp/test01.png' upload_path = '/tmp/test01.png' s3_client.download_file(bucket, key, download_path) s3_client.upload_file(upload_path, bucket, 'thumbnail-test01.png') | cs |
[reference] https://www.qwiklabs.com
반응형
'서버시스템' 카테고리의 다른 글
[Cloud_Class] 190108_EMR(Hadoop) (0) | 2019.01.09 |
---|---|
[Cloud_Class] 190104 Githook (0) | 2019.01.09 |
[AWS] Lambda programming for DynamoDB (0) | 2019.01.06 |
[AWS] Quick Starts (0) | 2019.01.04 |
[Cloud_Class] 190103 Elastic Beanstalk (0) | 2019.01.04 |
Comments