Terraform resource: aws launch template
Jump to navigation
Jump to search
Official example[edit]
resource "aws_launch_template" "example" {
name = "example"
block_device_mappings {
device_name = "/dev/sdf"
ebs {
volume_size = 20
}
}
capacity_reservation_specification {
capacity_reservation_preference = "open"
}
cpu_options {
core_count = 4
threads_per_core = 2
}
credit_specification {
cpu_credits = "standard"
}
disable_api_stop = true
disable_api_termination = true
ebs_optimized = true
iam_instance_profile {
name = "test"
}
image_id = "ami-test"
instance_initiated_shutdown_behavior = "terminate"
instance_market_options {
market_type = "spot"
}
instance_type = "t2.micro"
kernel_id = "test"
key_name = "test"
license_specification {
license_configuration_arn = "arn:aws:license-manager:eu-west-1:123456789012:license-configuration:lic-0123456789abcdef0123456789abcdef"
}
metadata_options {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 1
instance_metadata_tags = "enabled"
}
monitoring {
enabled = true
}
network_performance_options {
bandwidth_weighting = "vpc-1"
}
network_interfaces {
associate_public_ip_address = true
}
placement {
availability_zone = "us-west-2a"
}
ram_disk_id = "test"
vpc_security_group_ids = ["sg-12345678"]
tag_specifications {
resource_type = "instance"
tags = {
Name = "test"
}
}
user_data = filebase64("${path.module}/example.sh")
}
Related[edit]
See also[edit]
- Terraform AWS resources: IAM, Net, EC2, ECS, ECR, S3, Route53, ACM, CloudWatch, CloudFront SES, RDS, DLM
- Terraform AWS: providers, modules, resources
hashicorp/aws
Advertising: