acceptable-plumber-31485
03/15/2023, 6:11 PMpulumi up
?
for az in aws.get_availability_zones().names:
server = aws.ec2.Instance(
f"web-server-{az}",
instance_type="t2.micro",
vpc_security_group_ids=[group.id],
ami=ami.id,
user_data="""#!/bin/bash
echo \"Hello, World -- from {}!\" > index.html
nohup python3 -m http.server 80 --bind 0.0.0.0 &
""".format(
az
),
tags={
"Name": "web-server",
},
)
ips.append(server.public_ip)
hostnames.append(server.public_dns)
attachment = aws.lb.TargetGroupAttachment(
f"web-server-{az}",
target_group_arn=target_group.arn,
target_id=server.id,
port=80,
)
billowy-army-68599
03/15/2023, 6:34 PMacceptable-plumber-31485
03/15/2023, 6:51 PMdata cloudinit_config
where it references an external yml file. The yml file has an entry write_files:
and under it are the path, owner, permissions, encoding and content. I don't know if the yml file content is specific for terraform thoughimport cloudinit
?
cloudconfig = cloudinit.get_config(
base64_encode = False,
gzip = False,
parts = [
cloudinit.GetConfigPartArgs(
content = "#cloudconfig\npackages:\n- prometheus-node-exporter",
content_type = "text/cloud-config",
filename = "init.cfg"
)
]
)
pip3 install pulumi_cloudinit