AWS EC2 userdata sample script
Sample of an AWS EC2 userdata
script that install apache
and automatically creates an index.html
file as a landing webpage with information about the instance - instanceId
, availabilityZone
, instanceType
and region
. This could also be used with launch configuration on an Auto Scaling Group (ASG
) to use as multiple instance on Elastic Load Balancing load balancer (ALB
) to easy show the usage of multiple instances behind the load balancer.
Other samples on AWS
-
Sample EC2 with webserver - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
-
SAmple EC2 metadata - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html
If you tried it and helped you understand better how it works, please leave a comment.
Happy learnings,
Antonio
Comments