Manage Job Application using AWS Free Service

High Level Architecture

Static Website:

<html>
<head>
<title>Please upload your Resume< </title>
<center><h2>Upload your Resume to apply for the job </h2>
<br></br>
<form method="post" enctype="multipart/form-data", action="https://ua6zsjvy23.execute-api.us-east-1.amazonaws.com/v1/upload">
Select File:
<input type="file" name="file"><br><br><br>
<input type="submit" name="submit" value="Submit">
</head>
</center>
</form>
</html>

AWS Lambda function:

import json
import base64
import boto3
import email
def lambda_handler(event, context):
s3 = boto3.client("s3")

client = boto3.client('sns')
# decoding form-data into bytes
post_data = base64.b64decode(event["body"])
# fetching content-type
try:
content_type = event["headers"]["Content-Type"]
except:
content_type = event["headers"]["content-type"]
# concate Content-Type: with content_type from event
ct = "Content-Type: " + content_type + "\n"
# parsing message from bytes
msg = email.message_from_bytes(ct.encode() + post_data)
# checking if the message is multipart
print("Multipart check : ", msg.is_multipart())
# if message is multipart
if msg.is_multipart():
multipart_content = {}
# retrieving form-data
for part in msg.get_payload():
# checking if filename exist as a part of content-disposition header
if part.get_filename():
# fetching the filename
file_name = part.get_filename()
multipart_content[
part.get_param("name", header="content-disposition")
] = part.get_payload(decode=True)
# filename from form-data
#file_name = json.loads(multipart_content["Metadata"])["filename"]
# u uploading file to S3
s3_upload = s3.put_object(
Bucket="aws-bucket-to-store-Resume", Key=file_name, Body=multipart_content["file"]
)

#Send email to HR
topic_arn = 'arn:aws:sns:us-east-1:4396202xxxx:Resume_Manager'
message = 'A job application has been received. Please check the Bucket for all Resume'
client.publish(TopicArn=topic_arn,Message=message)
# on upload success
return {"statusCode": 200, "body": json.dumps("Thank you for your intrest in this job. We will get back to you soon")}
else:
# on upload failure
return {"statusCode": 500, "body": json.dumps("Upload failed!")}

API Gateway:

API Gateway Configuation

AWS SNS:

--

--

--

I’m an System Administrator have keen interest and experienced in Cyber Security and Cloud Services

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CS371p Fall 2021: Jesus Luna

My First Software Development Competition’s Win

How to use MongoDB with Serverless Cloud

How your business can benefit from using Elixir and Phoenix

Five defining factors in Product Management

What do I prefer Mongo or SQL ?

Plutos Network February 2022 Update

Enterprise Mobile Apps: Why You Should Care

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Waq Ahmed

Waq Ahmed

I’m an System Administrator have keen interest and experienced in Cyber Security and Cloud Services

More from Medium

Free Association Design System and functional E-commerce Experience

How to create the Project using Spring Boot?

How to create a microservice with API Gateway, AWS Lambda and SAM CLI using Java 8

Level Up With Tech: EC2, DynamoDB and IAM Role’s Based Permissions