This template creates a launch template and an instance profile. The instance profile references the IAM role being created (with ReadOnlyAccess managed policy) and can provide the role's temporary credentials to an application that runs on the instances created by this launch template. The launch template also prevents accidental instance termination when using the Amazon EC2 console, CLI, or API, by specifying `true` for the `DisableApiTermination` property. If the instances created by this launch template are launched in a default VPC, they receive a public IP address by default. If the instances are launched in a nondefault VPC, they do not receive a public IP address by default.

CloudFormation Template