github.com/adamar/terraform@v0.2.2-0.20141016210445-2e703afdad0e/website/source/docs/providers/aws/r/instance.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_instance" 4 sidebar_current: "docs-aws-resource-instance" 5 --- 6 7 # aws\_instance 8 9 Provides an EC2 instance resource. This allows instances to be created, updated, 10 and deleted. Instances also support [provisioning](/docs/provisioners/index.html). 11 12 ## Example Usage 13 14 ``` 15 # Create a new instance of the ami-1234 on an m1.small node with an AWS Tag naming it "HelloWorld" 16 resource "aws_instance" "web" { 17 ami = "ami-1234" 18 instance_type = "m1.small" 19 tags { 20 Name = "HelloWorld" 21 } 22 } 23 ``` 24 25 ## Argument Reference 26 27 The following arguments are supported: 28 29 * `ami` - (Required) The AMI to use for the instance. 30 * `availability_zone` - (Optional) The AZ to start the instance in. 31 * `ebs_optimized` - (Optional) If true, the launched EC2 instance will be 32 EBS-optimized. 33 * `instance_type` - (Required) The type of instance to start 34 * `key_name` - (Optional) The key name to use for the instance. 35 * `security_groups` - (Optional) A list of security group IDs or names to associate with. 36 If you are within a VPC, you'll need to use the security group ID. Otherwise, 37 for EC2, use the security group name. 38 * `subnet_id` - (Optional) The VPC Subnet ID to launch in. 39 * `associate_public_ip_address` - (Optional) Associate a public ip address with an instance in a VPC. 40 * `private_ip` - (Optional) Private IP address to associate with the 41 instance in a VPC. 42 * `source_dest_check` - (Optional) Controls if traffic is routed to the instance when 43 the destination address does not match the instance. Used for NAT or VPNs. Defaults true. 44 * `user_data` - (Optional) The user data to provide when launching the instance. 45 * `iam_instance_profile` - (Optional) The IAM Instance Profile to 46 launch the instance with. 47 * `tags` - (Optional) A mapping of tags to assign to the resource. 48 49 ## Attributes Reference 50 51 The following attributes are exported: 52 53 * `id` - The instance ID. 54 * `availability_zone` - The availability zone of the instance. 55 * `key_name` - The key name of the instance 56 * `private_dns` - The Private DNS name of the instance 57 * `private_ip` - The private IP address. 58 * `public_dns` - The public DNS name of the instance 59 * `public_ip` - The public IP address. 60 * `security_groups` - The associated security groups. 61 * `subnet_id` - The VPC subnet ID.