Professional Documents
Culture Documents
2013HM15511 Mohit Agrawal
2013HM15511 Mohit Agrawal
DISSERTATION
By
Mohit Agrawal
2013HM15511
By
Mohit Agrawal
2013HM15511
ABSTRACT
Infra Free Solution (IFS) is a proposed model for all IT organizations to automate infrastructure
events. Infra Free Solution (IFS) is a collection of scripts that comprises all the details required
for automating the Infrastructure events, which take place in all IT organizations. Infra Free
Solution (IFS) enables the automation feasibility for daily and repeated events, which consume
most of the time of employees.
Hardware Requirement:
Technical Keywords:
Amazon Lambda, Amazon CloudWatch, Amazon CloudTrail, SNS, AWS S3, AWS EC-2, VPC,
AWS IAM.
Advantages:
Existing System:
Proposed System:
1. In the proposed system, we use the AWS Lambda to work synchronously to follow the
standard procedure.
2. Reduce or eliminate human interactions involved
Infra Free Solutions (IFS)
Infra Free Solutions (IFS)
Infra Free Solutions (IFS)
Contents
1. Introduction: ........................................................................................................................................................................1
1.1 Infra Setup ..........................................................................................................................................................................2
1.2 Infra Events and closure .....................................................................................................................................................2
1.3 About the tool used: UFT ...................................................................................................................................................3
2. The Existing System..............................................................................................................................................................3
2.1 Process Involved In Acknowledging Events/Incidents .......................................................................................................3
2.2 Process Involved in Acknowledging Events/Incidents (user related) .................................................................................4
2.3 Process Involved in Acknowledging Events/Incidents (S3 Bucket related) ........................................................................5
3. Difficulties of Existing solution .............................................................................................................................................6
4. Benefits of implementing IFS in the existing solution ..........................................................................................................6
4.1 Benefits achieved by implementing Automation in the project ........................................................................................7
5. Requirements .......................................................................................................................................................................8
5.1 Functional Requirements ...................................................................................................................................................8
5.2 Non Functional Requirements ...........................................................................................................................................9
6. Scope ....................................................................................................................................................................................9
6.1 In scope ..............................................................................................................................................................................9
6.2 Out of Scope.....................................................................................................................................................................10
7. System Design overview ....................................................................................................................................................10
7.1 Development Environment ..............................................................................................................................................10
7.2 Solution Design approach ................................................................................................................................................10
8. Future Course of Action .....................................................................................................................................................11
8.1 Deploying VPC ..................................................................................................................................................................13
8.2 Launching EC-2 Instances .................................................................................................................................................17
8.3 Creating S3 Buckets..........................................................................................................................................................23
9. Automating Infra Events using IFS Solution: ......................................................................................................................26
9.1 Automating EC-2 Instances: .............................................................................................................................................26
9.1.1Auto Starting EC-2 Instances ......................................................................................................................................26
9.1.2Auto Stopping EC-2 Instances ....................................................................................................................................32
9.2 Automating S3 Buckets: ...................................................................................................................................................39
9.2.1 Event Handling in S3 Bucket .....................................................................................................................................39
9.2.2Event Handling in S3 Bucket ......................................................................................................................................42
10. Configuring SNS Service ............................................................................................................................................45
11. Amazon CloudTrail ...................................................................................................................................................49
12. Abbreviation used in Report: ...................................................................................................................................54
13. References ................................................................................................................................................................55
14. Checklist ...................................................................................................................................................................56
P a g e 0 | 57
Infra Free Solutions (IFS)
1. Introduction:
Cloud computing is a domain which provides n numbers of services and various IT platforms for
building/maintaining IT Infra. While the benefits of private clouds can be compelling for many IT
with the advantages of public cloud. In such circumstances, a hybrid cloud may prove to be the better
choice:
Infra Free Solution (IFS) is a proposed model for all IT organizations to automate infrastructure
events. Infra Free Solution (IFS) is a collection of scripts that comprises all the details required for
automating the Infrastructure events, which take place in all IT organizations. Infra Free Solution (IFS)
enables the automation feasibility for daily and repeated events, which consume most of the time of
employees.
Handling these IT Infrastructure events manually is a very tedious and time-consuming job since
it requires referring lot of documents and data, which will lead to the failure of on -time delivery to the
customer. To overcome this problem, I have decided to automate some typical and repeated
infrastructure events through Infra Free Solution (IFS) design, which would preferably give the solution
P a g e 1 | 57
Infra Free Solutions (IFS)
IT infra can be of various types based on the requirements/users/applications etc. In my project, I have
1. BITS domain containing two Windows server and one Linux machine.
As mentioned above, events can be of any type including logging issue, unauthorized access, S3 Bucket
upload/delete/create, cloud instances related issues etc. All these events or these can also be called incidents for
security purpose; can consumes lots of time to login and check manually by the System Admin.
Considering the above facts, I have planned to automate the following IT incidents/events and closure
The objective is to reduce System Admin efforts and automatic closure of the repetitive IT
events/incidents in our environment. The scripts can be enhanced or modified and used for other
events, which have similar functionalities with minimal modifications and future iterations of project.
P a g e 2 | 57
Infra Free Solutions (IFS)
Amazon Lambda is used to automate the test cases and test IT events. Private cloud is being
used, at the time of implementation (while building Infra), all test objective will never be
changed. Only the events will be changed as per the test requirement, which will be taken place
in our environment.
A system engineer must be assigned for acknowledging the alert generated by our environment.
IT Admin has to manually login, check, and verify each alert, which are triggered. For each alert
or incident, an incident number will be generated then it needs to be tracked until it gets fixed.
Hence, as a first step, a System Admin has to be appointed, to acknowledge all the alert and
Manual Process:
Step3. Engineer checks the associated permission of user for particular task/action.
Step4. Engineer takes necessary action according to the organization’s policy and user’s
authorization. Step5. Engineer notifies the respective team and management regarding the
P a g e 3 | 57
Infra Free Solutions (IFS)
All these above-mentioned steps involved for an engineer to login and manually verify events,
For e.g. If an engineer wants to work on 10 alerts/incidents; he has to spend 15*15 = 225
Automated Process:
Automated process has not been tested yet. Once Amazon Lambda is deployed in our Infra, we
Manual Process:
Step4. Engineer takes necessary action according to the organization’s policy and user’s
requirement. Step5. Engineer notifies the respective team and management regarding the
All these above-mentioned steps involved for an engineer to login and manually verify
For e.g. If an engineer wants to work on 10 alerts/incidents; he has to spend 15*15 = 225
P a g e 4 | 57
Infra Free Solutions (IFS)
Automated Process:
Automated process has not been tested yet. Once Amazon Lambda is deployed in our Infra, we
Manual Process:
Step4. Engineer takes necessary action according to the organization’s policy and user’s
requirement. Step5. Engineer notifies the respective team and management regarding the
All these above-mentioned steps involved for an engineer to login and manually verify
For e.g. If an engineer wants to work on 10 alerts/incidents; he has to spend 15*15 = 225
Automated Process:
Automated process has not been tested yet. Once Amazon Lambda is deployed in our Infra, we
P a g e 5 | 57
Infra Free Solutions (IFS)
Existing IT organization uses typical IT infra, which contains many upfront Hardware resources,
work forces and a big office. These altogether requires a team, which needs to manage all this.
Thus, it adds more human interaction, which results in increased demand of infra/space
continuously.
Apart from this, human interaction takes more time to complete assigned task as compared to
automated job.
Now in the world of competition, we need to provide reliable, secured, and fast solutions to our
Customers so we need to offer automation for repetitive jobs, which takes less time and provide
more profit.
The idea is to implement Automation for the events handling in our environment.
The following are the benefits of implementing IFS frame work to legacy applications, especially
banking suite:
∑ Supports Automation.
∑ Easy to schedule scripts using Amazon Lambda which will save efforts of manually
running scripts
P a g e 6 | 57
Infra Free Solutions (IFS)
∑ Repeatability
∑ Coverage
∑ Reliability
One of the biggest strengths of AWS Lambda functions is the reduced cost of execution. In a
traditional web application, with code hosted on – and accessible through – an EC2 instance in
AWS, you need to pay for the server usage regardless of whether or not your API is actually in-
use. This idle-time cost can be very expensive, depending on the particulars of the instance you
are working with AWS Lambda functions, you only pay for the computing costs that your code
makes use of. AWS Lambda functions are billed by the millisecond of CPU time, instead of as a
flat and scaling fee based on usage. We don’t need to worry about scaling our instance (for the
most part – AWS does request that you inform them of any massive changes in scale), nor do
we need to worry about spinning up an instance or web server. AWS handles all this for us.
If our code is only active for one hour, we only pay for one hour – greatly reducing our cost of
execution. Furthermore, the first million (yes, 1,000,000) requests per month are free of charge.
Meaning if you never exceed a million requests (with some transfer limits), we’ll never have to
pay a dime!
P a g e 7 | 57
Infra Free Solutions (IFS)
∑ After alert fixes, by using automation, fresh data creation is easy and helps to validate
∑ Automation immensely helps in validating pricing test scenarios. Data creation (user
creation/ bucket creation etc.) using automated scripts, after database refresh, will
effectively reduce the effort and highlights the client that automation will benefit them by
∑ The automation of IT events/alerts is helpful for current projects and helps in using this
5. Requirements
As described in detail in the initial Introduction and Problem Description, there is a strong
are the core to create any IT organizations. The requirements are classified in further detail as
listed below
The following are the leading features that are to be included while automating these IT Infra.
FR1. Create any number of AWS instances with combination of customer type
FR3. Create any number of user groups to assign various roles and permissions.
P a g e 8 | 57
Infra Free Solutions (IFS)
FR7. Can perform creation, deletion and closure for any number of alerts to check
NR3. Amazon Lambda’s trigger should be simple and able to execute by anyone.
NR6. Testing with multiple iterations of events would help to increase the
6. Scope
6.1 In scope
Number of Test cases for above events varies. We will show some basic repetitive
P a g e 9 | 57
Infra Free Solutions (IFS)
The aim is to automate the most repetitive IT events/alerts. Other project specific
The following section gives an overview of the conclusions reached during the Design Phase of the
dissertation. The section also aims at providing a brief description of the high level system architecture.
2017
Lambda
After a thorough analysis of the requirements of events type (taking into consideration the
testing cycles, duration of testing, stability of the environment, reusability etc.) Function based
When AWS Lambda executes our Lambda function on our behalf, it takes care of
provisioning and managing resources needed to run our Lambda function. When we
P a g e 10 | 57
Infra Free Solutions (IFS)
memory and maximum execution time that we want to allow for our Lambda function.
When a Lambda function is invoked, AWS Lambda launches a container (that is, an
8.4 Need to calculate the estimated time for event handling after deploying AWS Lambda.
P a g e 11 | 57
Infra Free Solutions (IFS)
AWS DASHBOARD:
P a g e 12 | 57
Infra Free Solutions (IFS)
Amazon VPC enables us to use our own isolated resources within the AWS Cloud and
P a g e 13 | 57
Infra Free Solutions (IFS)
b. We can either use ‘Start VPC Wizard’ or ‘Your VPC’ option for creating our
VPC.
P a g e 14 | 57
Infra Free Solutions (IFS)
c. We need to create Subnets under our BITS VPC. Use the CIDR format to specify our
Public Subnet: Instances, which will be deployed under BITS_Public subnet, will have
internet access.
Private Subnet: Instances, which will be deployed under BITS_Private subnet, will have no
internet access
P a g e 15 | 57
Infra Free Solutions (IFS)
d. After defining subnets, we need to create Internet Gateway for our VPC. An Internet
e. We also need to define Route Table for our VPC. A route table specifies how packets
are forwarded between the subnets within our VPC, the Internet, and our VPN
connection.
P a g e 16 | 57
Infra Free Solutions (IFS)
VPC: BITS
Subnets: BITS_Public & BITS_Private
Internet Gateway (IGW): Bits-IGW
P a g e 17 | 57
Infra Free Solutions (IFS)
These two ec-2 instance are Free-tier eligible. As per the customer requirement, we can go with all available
paid instances.
Below steps have been followed for launching ec-2 instance in our environment.
P a g e 18 | 57
Infra Free Solutions (IFS)
P a g e 19 | 57
Infra Free Solutions (IFS)
e. Assign appropriate tag to our ec-2 instance so it can be identified easily in our
environment.
P a g e 20 | 57
Infra Free Solutions (IFS)
g. Review all provided configuration and settings and launch our ec-2 instance.
h. Create a new Key Pair for our ec-2 instance and save it in a secure place. These Keys
P a g e 21 | 57
Infra Free Solutions (IFS)
i. Once we are done with all above steps, we can finally launch our instances. After
Note: Same steps has to be followed for launching any version or any AWS instance type.
P a g e 22 | 57
Infra Free Solutions (IFS)
Below steps have been followed for launching ec-2 instance in our environment.
P a g e 23 | 57
Infra Free Solutions (IFS)
P a g e 24 | 57
Infra Free Solutions (IFS)
We can follow all above steps in order to create n-number of S3 Buckets in our environment.
P a g e 25 | 57
Infra Free Solutions (IFS)
Cloud service providers charges us on the bases of what resources we use and run. For the
organizations, there might be possibility that their few servers are unused during the nights and
weekends. However, if our instances are running, we would be charged no matter we use them
or not. To overcome this issue and save the overall cost, we should think to stop our unused
EC2 instances in the night as well as in the weekends. This can reduce 30-40% overall cost.
Either we can stop our EC2 instances manually or we can set a schedule to Auto Start Stop
EC2 instance. If we have a large number of running instances, the manual method cannot be
possible or might be too irritating. However, we can schedule auto start stop EC2 instances at
regular intervals using Lambda functions. In this solution (IFS Solution), we are going to explain
a step by step guide how to start and stop our EC2 instance at specific time, nights, and/or
weekends.
To Schedule Auto Start EC2 Instance, we need to perform the following tasks.
P a g e 26 | 57
Infra Free Solutions (IFS)
Open the AWS Lambda Console and click Create a Lambda Function as shown in the
On the Select Blueprint page, click on Blank Function to choose it as shown in the
following figure.
P a g e 27 | 57
Infra Free Solutions (IFS)
Name: Auto_Start_EC2
On the Code entry type area, type the following script carefully.
Note: Instance-ID mentioned in code are used in our solution and these can be replaced accordingly.
On the same page, scroll-down to the Lambda function and handler section and
select Create a custom role and attach below code for created Role.
P a g e 28 | 57
Infra Free Solutions (IFS)
Click Save to save the changes. Click Allow and return to the Lambda Function
console.
On the same page, scroll-down to the Advanced Settings section and set
P a g e 29 | 57
Infra Free Solutions (IFS)
Finally click Next to proceed. On the Review page, click Create Function to complete
the wizard.
To test that our function works properly, make sure that the instance we mentioned
Click on the Test tab and then click Save and Test, if everything goes fine, we will see
To verify that instance is started, go to EC2 running instance list and check the status
P a g e 30 | 57
Infra Free Solutions (IFS)
Now, we have created the Lambda function and IAM role, however, we have still not defined
the time when this instance should start. For this, we need to create an Event scheduler.
Open the Cloud Watch console; click Rules in the left pane.
In the Cron expression box, set the desired time when we want to start our instances.
In the right pane, select the Lambda Function as Targets and then select the Lambda
Click Configure details to proceed. On the Configure details page, specify the rule
P a g e 31 | 57
Infra Free Solutions (IFS)
Now we have done all the steps. Just wait for the time we mentioned in the schedule
Using the similar process, we can also schedule auto stop event for specific instances at
specific time.
Cloud service providers charges us on the bases of what resources we use and run. For the
organizations, there might be possibility that their few servers are unused during the nights
and weekends. However, if our instances are running, we would be charged no matter we use
them or not. To overcome this issue and save the overall cost, we should think to stop our
unused EC2 instances in the night as well as in the weekends. This can reduce 30-40%
overall cost.
Either we can stop our EC2 instances manually or we can set a schedule to Auto Start Stop
EC2 instance. If we have a large number of running instances, the manual method cannot be
possible or might be too irritating. However, we can schedule auto start stop EC2 instances at
regular intervals using Lambda functions. In this solution (IFS Solution), we are going to
explain a step by step guide how to start and stop our EC2 instance at specific time, nights,
and/or weekends.
To Schedule Auto Stop EC2 Instance, we need to perform the following tasks.
P a g e 32 | 57
Infra Free Solutions (IFS)
Open the AWS Lambda Console and click Create a Lambda Function as shown in the
On the Select Blueprint page, click on Blank Function to choose it as shown in the
following figure.
P a g e 33 | 57
Infra Free Solutions (IFS)
Name: Auto_Stop_EC2
On the Code entry type area, type the following script carefully.
P a g e 34 | 57
Infra Free Solutions (IFS)
Note: Instance-ID mentioned in code are used in our solution and these can be replaced accordingly.
On the same page, scroll-down to the Lambda function and handler section and
select Create a custom role and attach below code for created Role.
P a g e 35 | 57
Infra Free Solutions (IFS)
Click Save to save the changes. Click Allow and return to the Lambda Function console.
On the same page, scroll-down to the Advanced Settings section and set
Finally click Next to proceed. On the Review page, click Create Function to complete the
wizard.
To test that our function works properly, make sure that the instance we mentioned during
Click on the Test tab and then click Save and Test, if everything goes fine, we will see the
P a g e 36 | 57
Infra Free Solutions (IFS)
To verify that instance is started, go to EC2 running instance list and check the status
Now, we have created the Lambda function and IAM role, however, we have still not defined the
time when this instance should start. For this, we need to create an Event scheduler.
Open the Cloud Watch console; click Rules in the left pane.
In the Cron expression box, set the desired time when we want to start our instances. In
In the right pane, select the Lambda Function as Targets and then select the Lambda
P a g e 37 | 57
Infra Free Solutions (IFS)
Click Configure details to proceed. On the Configure details page, specify the rule
Now we have done all the steps. Just wait for the time we mentioned in the schedule
Using the similar process, we can also schedule auto stop event for specific instances at
specific time.
P a g e 38 | 57
Infra Free Solutions (IFS)
The Amazon S3 notification feature enables you to receive notifications when certain events
happen in our bucket. To enable notifications, we must first add a notification configuration
identifying the events we want Amazon S3 to publish, and the destinations where we want
An object created event – We choose ObjectCreated (All) when configuring our events in the
console to enable notifications for anytime an object is created in your bucket. On the other
hand, we can select one or more of the specific object-creation actions to trigger event
notifications. These actions are “Put, Post, Copy, and CompleteMultiPartUpload”.
P a g e 39 | 57
Infra Free Solutions (IFS)
P a g e 40 | 57
Infra Free Solutions (IFS)
P a g e 41 | 57
Infra Free Solutions (IFS)
An object delete event – We select ObjectDelete (All) when configuring our events in the
console to enable notification for anytime an object is deleted. On the other hand, we can select
Delete to trigger event notifications when a un-versioned object is deleted or a versioned object
is permanently deleted.
P a g e 42 | 57
Infra Free Solutions (IFS)
P a g e 43 | 57
Infra Free Solutions (IFS)
P a g e 44 | 57
Infra Free Solutions (IFS)
1. Go to AWS Services; under Messaging, select Simple Notification Service (SNS). It will
take us to below page.
2. Select ‘create new topic’. Here I am using SNS service to be notified for our Lambda
Function for EC-2 instances.
P a g e 45 | 57
Infra Free Solutions (IFS)
4. To add an email address, choose Create subscription. For Protocol, choose Email. For
Endpoint, type the email address of the new recipient.
P a g e 46 | 57
Infra Free Solutions (IFS)
Once we select ‘Publish a topic’, we can define our Notification structure as below:
P a g e 47 | 57
Infra Free Solutions (IFS)
P a g e 48 | 57
Infra Free Solutions (IFS)
Event history allows us to view, search, and download the past seven days of supported activity
in our AWS account. We can create a CloudTrail trail to further archive, analyze, and respond to
changes in our AWS resources.
A trail is a configuration that enables delivery of events to an Amazon S3 bucket that we
specify. We can also deliver and analyze events in a trail with Amazon CloudWatch Logs and
Amazon CloudWatch Events.
P a g e 49 | 57
Infra Free Solutions (IFS)
Amazon Trails
Amazon CloudTrail deliver logs to an Amazon S3 bucket. CloudTrail events can be processed
by one trail for free.
When you create a trail that applies to all regions, CloudTrail creates the same trail in each
region. It then records events in each region and delivers the CloudTrail event log files to an S3
bucket that you specify. This is the default option when you create a trail in the CloudTrail
console.
When you create a trail that applies to one region, CloudTrail records the log files in that region
only. It then delivers the CloudTrail event log files log to an S3 bucket that you specify. If you
create additional single trails, you can have those trails deliver CloudTrail event log files to the
same Amazon S3 bucket or to separate buckets.
Note: For both types of trails, you can specify an Amazon S3 bucket from any region
Below are the steps to configure CloudTrail in our environment:
P a g e 50 | 57
Infra Free Solutions (IFS)
P a g e 51 | 57
Infra Free Solutions (IFS)
To be notified through Emails and to have an eye on our Infra/environment, I have configured
CloudWatch Rule to identify an event and keep us updated about occurred events.
P a g e 52 | 57
Infra Free Solutions (IFS)
We are notified for each action taken on our S3 buckets like below:
We can set n-number of rules and CloudWatch events to monitor our Infra by following above
steps
P a g e 53 | 57
Infra Free Solutions (IFS)
P a g e 54 | 57
Infra Free Solutions (IFS)
13. References
1. https://aws.amazon.com/documentation/
2. https://github.com/
3. https://acloud.guru/
4. https://www.udemy.com/
P a g e 55 | 57
Infra Free Solutions (IFS)
14. Checklist
P a g e 56 | 57