-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlambda.py
30 lines (21 loc) · 870 Bytes
/
lambda.py
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
import json
import boto3
import uuid
transcribe = boto3.client('transcribe')
def lambda_handler(event, context):
print("Hello..")
filename = event['Records'][0]['s3']['object']['key']
bucketname = event['Records'][0]['s3']['bucket']['name']
url = "s3://" + bucketname + "/" + filename
myuuid = uuid.uuid1().int
response = transcribe.start_transcription_job(
TranscriptionJobName="mylwaudiojob" + "-" + str(myuuid),
LanguageCode='en-US',
MediaFormat='mp3',
Media={
'MediaFileUri': url,
},
OutputBucketName="lws3transcribetest123",
OutputKey="mylwaudiojob" + "-" + str(myuuid) + ".json"
)
print(response)