Professional Documents
Culture Documents
Fig 1.1:
3. Create Application:
Open this service and click on “Create application”. On next configure page, add
environment tier as web server environment and type any application name.
Fig 1.2:
4. Select Platform and Review:
Select Platform as language per your need ex- Python and select sample code or
upload your code and click on next and keep everything as default.
Fig 1.3:
Fig 1.4:
For service access: select service role as use an existing role if role already
created or select Create and use new service role and type role name and click on
next.
Fig 1.5:
Set up network and configuring database tags and select vpc and other tags and
click on next.
Fig 1.6:
Select instance traffic and scaling (default) and click on next.
Fig 1.7:
Fig 1.8:
Configure updates, monitoring, select Cloud watch and click on next.
Fig 1.9:
Review everything and click on submit, application is successfully created now
with environment.
Fig 1.10:
Fig 1.11:
Q2.) Create an IAM user and attach policy EC2 Full access to created user.
Ans. Steps for the given assignment are as follows:
1. Sign In and Navigate to the Console: Log in to your AWS Management Console.
2. Navigate to IAM: Search for and select the "IAM" service from the AWS Management
Console.
Fig 2.1:
3. Create a user:
Fig 2.2:
Provide the name of the user and click on next.
Fig 2.3:
4. Set Permissions:
Set the permissions and provide the EC2 full access and click on next.
Click on create user.
Fig 2.4:
Fig 2.5:
Q3.) Create Role for EC2 start instance from IAM policy section and write a Lambda
function for start instance automatically using created role above.
Ans. Steps to Create and host a publicly accessible static website on a Windows Server 2012
instance using Amazon EC2:
1. Sign In and Navigate to the Console:
Log in to your AWS Management Console.
2. Navigate to IAM:
Search for and select the "IAM" (Identity and Access Management) service from the AWS
Management Console.
Fig 3.1:
3. Create an IAM Policy:
In the IAM dashboard, click on "Policies" in the left sidebar.
Fig 3.2:
Choose the service (EC2) and actions (StartInstances, StopInstances) you want to
allow.
Fig 3.3:
Fig 3.4:
Click "Next," provide a name and description, and then create the policy.
Fig 3.5:
Fig 3.6:
4. Create IAM Role for Lambda:
In the IAM dashboard, click on "Roles" in the left sidebar.
Fig 3.7:
Choose the service "Lambda" and attach a policy that allows starting EC2 instances.
Fig 3.8:
Fig 3.9:
Name the role (e.g., "EC2_Role") and create the role.
Fig 3.10:
Fig 3.11:
5. Create Lambda Function:
Navigate to AWS Lambda from the console.
Fig 3.12:
Click "Create function."
Fig 3.13:
Choose "Author from scratch," name your function, select the runtime (e.g., Python 3.8), and
choose the IAM role created earlier.
Fig 3.14:
Click "Create function."
Fig 3.16:
7. Test the Lambda Function:
Configure a test event for your Lambda function, providing a JSON object with an "action"
property (either "start" or "stop").
Fig 3.17:
Test the function to see if it starts the specified EC2 instance.
Fig 3.18:
Q4. ) Write a Lambda Function to poll Simple queue message from SQS.
Ans. Steps for the given assignment are as follows:
Step 1: Create a Lambda Function:
Sign in to the AWS Management Console.
Navigate to Lambda and click on "Create Function."
Fig: 4.1
Fig: 4.2
Give the function a name, set the runtime to Python 3.9 and set the Architecture to
“arm64”.
Fig: 4.3
Under Permissions, set the Execution role to “Create a new role from AWS policy
templates”, give your role a name and set the policy template to “Amazon SQS poller
permissions”.
Fig: 4.4
Click on “Create Function”.
Under code, write the following code and click on “Deploy”.
import json
def lambda_handler(event, context):
print(event)
Fig: 4.6
Click "Create Queue."
Fig: 4.7
Set the type to Standard and let the remaining set to default.
Fig: 4.8
Click on the queue created and then “Send and receive messages”.
Enter the message into the message body and click on “send message”.
Fig: 4.9
The queue will have some available message now.
Fig: 4.10
Step 3: Add a trigger to Lambda function:
Navigate to your lambda function.
Click on “Add Trigger” and select SQS as the source.
Fig: 4.11
Under SQS Queue, select the Queue you created earlier.
Fig: 4.12
Click on “Add”.
Open the queue created earlier, the messages available will be 0 now.
Fig 4.13
Q5. ) Demonstrate Simple notification service using Email service.
Ans. Steps for the given assignment are as follows:
1) Sign In and Navigate to the Console
Log in to your AWS Management Console.
2) Navigate to Amazon SNS
Click on "Create topic."
Fig 5.1:
Fig 5.2:
Provide a name and display name for your topic.
Fig 5.3:
Click "Create topic."
Fig 5.4:
3) Create Subscribers (Endpoints)
After creating the topic, click on the topic name.
Fig 5.5:
Under "Create subscription," select the “Email” protocol.
Enter the endpoint details, i.e an email address.
Fig 5.6:
4) Confirm Subscriptions
Depending on the protocol, you might need to confirm subscriptions. For
example, you might need to click a confirmation link sent to your email.
Fig 5.7:
5) Publish a Message to the Topic
After confirming subscriptions, go back to the topic page.
Fig 5.8:
Click "Publish message."
Enter a subject and message for the notification.
Fig 5.9:
Click "Publish message."
Fig 5.10:
6) Receive Notifications
You’ll receive a notification, for email, check your inbox.
If you're done demonstrating, you can delete the topic and unsubscribe endpoints
to avoid any further notifications.
Fig 5.11: