PROG2003 – Cloud Systems Development Assignment 2
Assignment 2: AWS Lambda Apps and Report
Due Date: Week 9 Friday at 11.00 pm Submission Method: Blackboard Weight: 25% of Overall Grade Type: Individual
PROG2003 – Cloud Systems Development Assignment 2
Overview: In Assignment 2, students are expected to demonstrate their level of understanding and skill attained through practicing the workshops on S3, DynamoDB, Lambda, and Lambda Events. The assignment has three parts (Part A: 5%, Part B: 5%, Part C: 15%).
Read this carefully: You have to implement a Lambda function that is connected with an S3 bucket by a trigger. The trigger should allow the Lambda function to get notified for all ‘Object Created’ events. This means that once a new object is created into that bucket, your Lambda function will be invoked. As a part of the invocation, your Lambda function should receive the event and bucket details. Your Lambda function will use this information to read the content of the object and insert some relevant entries into a DynamoDB table. You need to implement an additional app to create the bucket object. The second app will be used as a tester app for your Lambda function.
You need to use a specific AWS IAM role (robomaker_students) while creating your Lambda function. That particular role and its associated policy (Probomaker_students) do not allow DynamoDB access by default. Therefore, to make your Lambda function and tester app work, you need to make some changes to this policy.
Environment Setup: Use your classroom account to complete your assignment apps. It is mentioned below which version of the AWS SDK you have to use. For Assignment 2, you need to use the same S3 bucket you created for Assignment 1 (i.e., yourSCUusername-a1-s3bucket). You need to create a new DynamoDB table named Car. The schema of the DynamoDB table car is copied below for your convenience.
Car (Id, Model, Make, Year, Colour); Model, Make, Colour: String, Id, Year: Number
Part A – Report (5%): Write a report ( ) on how you have added DynamoDB access to the policy that belongs to the robomaker_students role (~300 words).
1. Note down the ARN of the robomaker_students role to the report.
2. In IAM console, check the ‘Permission Policies’ list and find out the ‘Access Level’ for
‘DynamoDB’ from that list. Record the access level you have found into your report. Initially, the access level should be ‘None’ as you still have not added permission for DynamoDB. Attach relevant screenshot(s) of this step to the report.
3. In IAM console, you now have to add all necessary permissions to the Probomaker_students policy for allowing DynamoDB access. Make sure you select all ‘resources’. Take screenshots of this step.
4. Now discuss in the report with relevant screenshots on how you have added the necessary permissions to access DynamoDB in the lambda function.
yourSCUusernameA2Report.docx
Probomaker_students
PROG2003 – Cloud Systems Development Assignment 2
Part B – (5%): Create a Java app (yourSCUusernameTesterApp) that creates an S3 object to test your Lambda function.
1. Your tester app must create a JSON file named car.json in the specified S3 bucket containing the following JSON array. The JSON array will be containing three JSON objects.
[{“Id”:1, “Model”: “Camry”, “Make”:”Toyota”, “Year”:2020, “Colour”:”Red”}, {“Id”:2, “Model”: “Pulsar”, “Make”:”Nissan”, “Year”:2021, “Colour”:”Black”}, {“Id”:3, “Model”: “CRV”, “Make”:”Honda”, “Year”:2019, “Colour”:”White”}, {“Id”:4, “Model”: “Xtrail”, “Make”:”Nissan”, “Year”:2021, “Colour”:”Black”}]
Please do not directly copy this array to your code. Hint: You can easily create this JSON array with your Java String variable using the backslash (‘\’). You do not need to use additional JSON package for this. Please conduct some research to find an appropriate way to implement this.
2. Your tester app should use AWS SDK 2 for S3 dependency. You should already be familiar with the implement of this app. You even can reuse your app from the workshop on S3 with minor modification.
3. Your tester app should use exception handling.
Part C – Lambda Function and Handler (15%): Implement a Lambda function that gets notified once an object (i.e., the JSON file) is created in the specified S3 bucket. The Lambda function then needs to read the content of the object, parse the information, and insert the parsed information into the specified DynamoDB table.
1. Handler: Create a Java app ( ) to implement the handler for your Lambda function. Please name your handler as . One of the handler parameters must accept S3 events. Your handler must:
a. Retrieve the ‘bucket’ and ‘key’ information from the S3 event notification.
b. Read the content in the ‘key’. The content would be a JSON array as specified in Part
c. Read each JSON object from the JSON array. For each JSON object, parse the values
of the fields – Id, Model, Make, Year, and Colour and insert these values into the
DynamoDB table, Car.
d. Following the insert, the program should update the “Year” and “Colour” fields of the
entry where “id” is equal to 4 (the latest entry). Use relevant values to update this
e. You need to use one/more loop(s) for this task.
You should use the org.json package to implement the JSON functionalities.
2. Your handler app should use AWS SDK 1 for S3 and DynamoDB dependencies (as shown in the workshop on Lambda events).
3. Your handler app should use exception handling.
yourSCUusernameHandlerApp
yourSCUusername ROG2003 – Cloud Systems Development Assignment 2
4. Add relevant comments in your code.
5. Create a Lambda function (yourSCUusername-function) using the handler.
6. Add an appropriate S3 trigger with the Lambda function that will allow your Lambda function
to get notified after a new object is created.
Submission Checklist: Following is the checklist, submit all in the list via Blackboard submission link. You can download the app from Cloud9 by right clicking on the app project folder it and then clicking download. You need to submit the full app folder. You need to use the classroom account for completing this assignment and share your username and password for this account with us. The
apps. Your submission will not be marked if they do not comply these requirements.
1. The report (word file) file, along with the complete assignment cover sheet (Part A).
2. Zipped app folder for the tester app (Part B).
3. Zipped app folder for the handler app (Part C).
IMPORTANT: DO NOT DELETE any of your apps, Lambda function, trigger, S3 bucket, CloudWatch log. All of these will be tested during marking your assignment.
marker will login to your classroom account and check your apps there. The marker will also check the
command history to make sure that you have used the classroom account console to complete the