The purpose of this document is to provide instructions for additional tasks which should be done during Zombie Apocalypse Workshop.
- Create a new lambda function, and call it: Zombie_MessageToS3. You can use the IAM Role from previous labs.
- This time, our lambda function will be created using Python 2.7 environment.
- Paste the code from scripts/Zombie_MessageToS3.py script.
- Create a new environment variable. The key is BUCKET_NAME, and the value is the name of your S3 bucket.
- Increase the execution time of this function to 1 minute.
- Add new trigger for this function: DynamoDB. Configure it, with your messages table.
- Wait 1-2 minute, and start writing new messages on your chat window. You should see that flat files are being saved on your S3 bucket with those messages.
- Open Athena service and execute following script (update the name of your S3 bukcet).
CREATE EXTERNAL TABLE IF NOT EXISTS default.zombie (
timestamp
bigint,
name
string,
message
string
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
'field.delim' = ','
) LOCATION 's3://BUCKET_NAME/data/'
TBLPROPERTIES ('has_encrypted_data'='false')
- Play with the interface and execute some standard S3 queries.
- Create a new IAM role, it should have access to following services: Polly, DynamoDB, CloudWatch, S3, SNS.
- Create a new lambda function, and call it: "Zombie_MessagesToAudio". Use role which you have created in previous point.
- Use Python 2.7 environment
- Paste the code from scripts/Zombie_MessagesToAudio.py script.
- Create a new environment variable. The key is BUCKET_NAME, and the value is the name of your S3 bucket.
- Create a new environment variable. The key is USERS_TABLE_NAME, and the value is the name of your DynamoDB table where you store users.
- Increase the execution time of this function to 1 minute.
- Add new trigger for this function: DynamoDB. Configure it, with your messages table.
- Test your application! In the chat window write: "/audio Joanna This is Zombie apocalypse!". You should get a SMS message!