This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "builders": [{ | |
| "type": "amazon-ebs", | |
| "region": "us-west-2", | |
| "source_ami": "ami-01ed306a12b7d1c96", | |
| "instance_type": "t2.micro", | |
| "ssh_username": "centos", | |
| "ami_name": "centos-packer-example-1.0" | |
| }] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "post-processors": [ | |
| [ | |
| "compress", | |
| { "type": "upload", "endpoint": "http://example.com" } | |
| ] | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "provisioners": [ | |
| { | |
| "type": "shell", | |
| "script": "./example.sh" | |
| } | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "builders": [{ | |
| "type": "amazon-ebs", | |
| "access_key": "{{user `aws_access_key`}}", | |
| "secret_key": "{{user `aws_secret_key`}}", | |
| "region": "us-east-1", | |
| "instance_type": "t2.micro", | |
| "ssh_username": "ubuntu", | |
| "ami_name": "packer-example {{timestamp}}" | |
| }] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data "aws_availability_zones" "all" {} | |
| resource "aws_autoscaling_group" "test-asg" { | |
| launch_configuration = "${aws_launch_configuration.asg-config.id}" | |
| availability_zones = ["${data.aws_availability_zones.all.names}"] | |
| target_group_arns = ["${var.target_group_arn}"] | |
| health_check_type = "ELB" | |
| min_size = "1" | |
| max_size = "2" | |
| tag { | |
| key = "Name" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_launch_configuration" "asg-config" { | |
| image_id = "${var.image_id}" | |
| instance_type = "${var.instance_type}" | |
| security_groups = ["${aws_security_group.asg-sg.id}"] | |
| lifecycle { | |
| create_before_destroy = true | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Modifying an EBS Volume | |
| $ aws ec2 modify-volume --volume-type io1 --iops 100 --size 10 --volume-id vol-Xyz123456 | |
| { | |
| "VolumeModification": { | |
| "TargetSize": 10, | |
| "TargetVolumeType": "io1", | |
| "ModificationState": "modifying", | |
| "VolumeId": "vol-Xyz123456", | |
| "TargetIops": 100, | |
| "StartTime": "2019-03-02T17:29:53.000Z", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| provider "aws" { | |
| region = "us-west-2" | |
| } | |
| resource "aws_lb" "my-test-lb" { | |
| name = "my-test-lb" | |
| internal = false | |
| load_balancer_type = "application" | |
| ip_address_type = "ipv4" | |
| subnets = ["${var.subnet_id1}", "${var.subnet_id2}"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_security_group" "alb-sg" { | |
| name = "my-alb-sg" | |
| vpc_id = "${var.vpc_id}" | |
| } | |
| resource "aws_security_group_rule" "http_allow" { | |
| from_port = 80 | |
| protocol = "tcp" | |
| security_group_id = "${aws_security_group.alb-sg.id}" | |
| to_port = 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_lb_target_group_attachment" "my-tg-attachment1" { | |
| target_group_arn = "${aws_lb_target_group.my-alb-tg.arn}" | |
| target_id = "${var.instance_id1}" | |
| port = 80 | |
| } | |
| resource "aws_lb_target_group_attachment" "my-tg-attachment2" { | |
| target_group_arn = "${aws_lb_target_group.my-alb-tg.arn}" | |
| target_id = "${var.instance_id2}" | |
| port = 80 |