-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathec2_create_lambda.py
More file actions
84 lines (78 loc) · 2.59 KB
/
ec2_create_lambda.py
File metadata and controls
84 lines (78 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import boto3
ec2_client = boto3.client('ec2', region_name='ap-south-1')
def lambda_handler(event, context):
response = ec2_client.run_instances(
BlockDeviceMappings=[
{
'DeviceName': '/dev/xvda',
'Ebs': {
'DeleteOnTermination': True,
'VolumeSize': 8,
'VolumeType': 'gp3',
'Encrypted': False,
'Iops': 3000,
},
},
],
ImageId='ami-09298640a92b2d12c',
InstanceType = 't2.micro',
MaxCount=1,
MinCount=1,
KeyName='tfuser',
UserData= '''#!/bin/bash
sudo yum update -y
sudo yum install httpd -y
sudo echo "<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>DevOps Learning</title>
</head>
<header>
<div class="header-content">
<div class="header-content-inner">
<body bgcolor="yellow">
<h1>Learn Cloud/DevOps with Automation Tools:</h1>
<hr>
<p><b> We are moving towards Cloud Computing and DevOps with Automation. There are a variety of tools available on the market. Here are the tools that are easy to learn!</b> </p>
<p><b> Cloud Technology</b> - AWS/Azure</p>
<p><b> Source Code Management Systems</b> - GitHub Enterprise, BitBucket </p>
<p><b> Continuous Integration and Continuous Deployment/Delivery</b> - ArgoCD, Jenkins, GitOps </p>
<p><b> Software Configuration Management Tool</b> - Ansible </p>
<p><b> Operating Systems</b> - RHEL 7/8, CentOS, Ubuntu/Debian, Windows </p>
<p><b> Containerization/Orchestration</b> - Docker, Kubernetes </p>
<p><b> Monitoring Tools</b> - AppDynamics, DataDog, New Relic, Zabbix </p>
</div>
</div
</header>
<footer>
<p>style="color:black;">© Copyright Cloudbird.fun 2023</p>
</footer>
</body>
</html>" > /var/www/html/index.html
sudo systemctl start httpd
sudo systemctl enable httpd''',
Monitoring={
'Enabled': False
},
SecurityGroupIds=[
'sg-0fb1052b659369aa8',
],
SubnetId='subnet-e9190a81',
TagSpecification=[
{
'Tags': [
{
'Name': 'LAMBDA-EC2',
'Owner': '[email protected]',
'Environment': 'Development',
'CostCentre': '10004532',
},
],
},
],
)