millions-parrot-88279
10/21/2022, 12:43 PMlittle-cartoon-10569
10/21/2022, 7:11 PMmillions-parrot-88279
10/22/2022, 8:01 PMlittle-cartoon-10569
11/07/2022, 11:42 PMmillions-parrot-88279
11/07/2022, 11:51 PMauthrole=aws.iam.Role(
"authrole" , name="rolelist", path="/",
assume_role_policy=json.dumps({
"Version": "2012-10-17",
"Statement":[{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Principal":{
"Service":"<http://ec2.amazonaws.com|ec2.amazonaws.com>"
}
}]
})
)
policyrole=aws.iam.RolePolicyAttachment(
"policyrole",
role=authrole.name ,
policy_arn="arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
)
myprofile=aws.iam.InstanceProfile(
"myprofile" ,
name="profilelist",
role=authrole.name
)
policyrole=aws.iam.RolePolicyAttachment(
"policyrole",
role=authrole.name ,
policy_arn="arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
)
myprofile=aws.iam.InstanceProfile(
"myprofile" ,
name="profilelist",
role=authrole.name
)
little-cartoon-10569
11/07/2022, 11:52 PMmillions-parrot-88279
11/07/2022, 11:59 PMmytemp1=aws.ec2.LaunchTemplate(
"mytemp1",
key_name="keys1auth",
image_id="ami-09d3b3274b6c5d4aa" ,
vpc_security_group_ids=[securewb.id] ,
iam_instance_profile=aws.ec2.LaunchTemplateIamInstanceProfileArgs(arn=myprofile.arn) ,
block_device_mappings=[
aws.ec2.LaunchTemplateBlockDeviceMappingArgs(
device_name="/dev/sdf",
ebs=aws.ec2.LaunchTemplateBlockDeviceMappingEbsArgs(
volume_size=8 ,
volume_type="gp2" ,
encrypted=False
)
)
],
instance_type="t2.micro"
)
mygps4=aws.autoscaling.Group(
"mygps4",
name="gps4" ,
vpc_zone_identifiers=[ websbts1.id , websbts2.id , websbts3.id ],
min_size=1,
max_size=9,
desired_capacity=3,
health_check_grace_period=300,
health_check_type="ELB" ,
default_cooldown=300 ,
launch_template=aws.autoscaling.GroupLaunchTemplateArgs(
id=mytemp1.id ,
version="$Latest"
)
)
myattachment= aws.autoscaling.Attachment(
"myattachment",
autoscaling_group_name=mygps4.name ,
lb_target_group_arn=mytargets.arn
)
mydoc4=aws.ssm.Document(
"mydoc4",
name="doc4" ,
content="""
schemaVersion: '1.2'
description: Check ip configuration of a Linux instance.
parameters: {}
runtimeConfig:
'aws:runShellScript':
properties:
- id: '0.aws:runShellScript'
runCommand:
- sudo yum update -y
- sudo yum upgrade -y
- sudo yum install httpd -y
- sudo yum install -y <https://s3.region.amazonaws.com/amazon-ssm-region/latest/linux_amd64/amazon-ssm-agent.rpm>
- sudo systemctl start httpd
- sudo systemctl enable httpd
- sudo systemctl start amazon-ssm-agent
- sudo systemctl enable amazon-ssm-agent
- sudo echo " welcome to sites " > /var/www/html/index.html
""",
document_format="YAML" , document_type="Command"
)
myssmlink1=aws.ssm.Association(
"myssmlink1",
name=mydoc4.name,
association_name="associates4ssm",
document_version=mydoc4.document_version ,
targets=[aws.ssm.AssociationTargetArgs(
key="InstanceIds" ,
values=["*"],
)]
)
little-cartoon-10569
11/08/2022, 12:00 AMmillions-parrot-88279
11/08/2022, 12:02 AMlittle-cartoon-10569
11/08/2022, 12:04 AMmillions-parrot-88279
11/08/2022, 12:06 AMlittle-cartoon-10569
11/08/2022, 12:27 AM