DEV Community

Cover image for How did I created EC2 by Voice?
Mohamed Latfalla for AWS Community Builders

Posted on

How did I created EC2 by Voice?

AWS is amazing, the services and the interconnection parts makes it fun and really enjoyable to work with, even for fun projects like this.
Do you want to try it? Click here

So, I was bored and decided: I want to launch EC2 with voice! Pretty simple. The diagram will show you how:

Image description

The diagram shows the whole story, but let's describe it a bit.

1- The record:

The first step is to create a unified statement that you want your transcription job to turn into text, which will be processed by the function.
For this example, I used a website to record my voice and to download it as mp3.

2- Upload the file:

Once I got the record, I uploaded it into S3 and let it work. I configured my bucket to send S3 payload into Lambda that I created to deal with what gets passed from this bucket action.

Image description

Then, Lambda and Transcribe time come.

3- Lambda time:

Once the payload triggers the function, I get what I need from the payload to pass it into Transcribe. These are straight forward steps.

I let it to identify the language because I didn't know the recorded voice will be with which accent. If I recorded it with my accent, I believe it will get a hard time understanding the Arabic accent of my English.

transcribeJob = transcribe.start_transcription_job(
                TranscriptionJobName=transcribeJobName,
                Media={
                     'MediaFileUri': 's3://'+bucketName+'/'+fileName
                       },
                IdentifyLanguage= True
)
Enter fullscreen mode Exit fullscreen mode

Then, waiting for Transcribe to finish its job.

4- Transcribe:

Transcribe is a fast service, despite that my record is short, the response you get is relatively fast.
So, I get the job status and look for TranscriptionJobStatus. Once I get Completed, I get the link that holds the text for my job.

This is an example from the console:

Image description

I do some basic verification over the words as I set the function to get some keywords like Create and Option to identify the action I want to do.

The next step is to check the resource that I want to make. I hardcoded it as I did the minimal for this example. But, as always, the sky is the limit.

5- Creation time:

Once all the previous steps are done, I loop over the pre-config list that I made and get the parameters to pass it into the command. In my case here is creating an EC2 instance.

Image description

And here you go, an instance got created because of a voice record.

To conclude:

There are many things you can do with event-driven architecture. This is a small, fun, waste of time for some, but great evidence that this kind of architecture is powerful. I did lambda execution via SMS before and it was fun. Check it out if you're interested in this kind of unusual actions with AWS Lambda.

Top comments (2)

Collapse
 
mmuller88 profile image
Martin Muller

Greate and creative article. There is a little typo in the picture "AWS Transcribe" :)

Collapse
 
imohd23 profile image
Mohamed Latfalla

Thanks and thanks for catching that up