-
Notifications
You must be signed in to change notification settings - Fork 0
/
beanstalk
58 lines (49 loc) · 1.5 KB
/
beanstalk
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
import boto3
def lambda_handler(event, context):
elb = boto3.client('elasticbeanstalk')
s3_resource = boto3.resource('s3')
#Create Application
app = elb.create_application(
ApplicationName='Html-login',
Description='html-application'
)
print(app)
#Create Apllication Version
app_version = elb.create_application_version(
ApplicationName='html-login',
VersionLabel='htmllogin',
Description='htmlversion',
SourceBundle={
'S3Bucket': 'htmlphp',
'S3Key': 'file.zip'
},
AutoCreateApplication=False,
Process=False
)
print(app_version)
#Create Environment
env = elb.create_environment(
ApplicationName='html-login',
EnvironmentName='html',
Description='html-web-page',
Tier={
'Name': 'WebServer',
'Type': 'Standard'
},
VersionLabel='htmllogin',
SolutionStackName="64bit Amazon Linux 2018.03 v2.8.6 running PHP 7.2",
OptionSettings=[
{
'Namespace': 'aws:elasticbeanstalk:environment',
'OptionName': 'EnvironmentType',
'Value': 'SingleInstance'
},
{
'Namespace': 'aws:autoscaling:launchconfiguration',
'OptionName': 'IamInstanceProfile',
'Value': 'aws-elasticbeanstalk-ec2-role'
},
]
)
print(env)
print("Done")