All Projects â†’ terraform-aws-modules â†’ Terraform Aws Ec2 Instance

terraform-aws-modules / Terraform Aws Ec2 Instance

Licence: other
Terraform module which creates EC2 instance(s) on AWS

Projects that are alternatives of or similar to Terraform Aws Ec2 Instance

Curso Aws Com Terraform
🎦 🇧🇷 Arquivos do curso "DevOps: AWS com Terraform Automatizando sua infraestrutura" publicado na Udemy. Você pode me ajudar comprando o curso utilizando o link abaixo.
Stars: ✭ 62 (-81.98%)
Mutual labels:  aws, aws-ec2, hcl
Multi Env Deploy
Complete example of deploying complex web apps to AWS using Terraform, Ansible, and Packer
Stars: ✭ 132 (-61.63%)
Mutual labels:  aws, aws-ec2, hcl
Aws Labs
step by step guide for aws mini labs. Currently maintained on : https://github.com/Cloud-Yeti/aws-labs Youtube playlist for labs:
Stars: ✭ 153 (-55.52%)
Mutual labels:  aws, aws-ec2, hcl
Terraform Aws Security Group
Terraform module which creates EC2-VPC security groups on AWS
Stars: ✭ 326 (-5.23%)
Mutual labels:  aws, hcl
Terraform Aws Tfstate Backend
Terraform module that provision an S3 bucket to store the `terraform.tfstate` file and a DynamoDB table to lock the state file to prevent concurrent modifications and state corruption.
Stars: ✭ 229 (-33.43%)
Mutual labels:  aws, hcl
Graylog2 Images
Ready to run machine images
Stars: ✭ 234 (-31.98%)
Mutual labels:  aws, aws-ec2
Terraform Aws Alb
Terraform module to create an AWS Application/Network Load Balancer (ALB/NLB) and associated resources
Stars: ✭ 217 (-36.92%)
Mutual labels:  aws, hcl
Terraform Examples
Terraform samples for all the major clouds you can copy and paste. The future, co-created.
Stars: ✭ 256 (-25.58%)
Mutual labels:  aws, hcl
Terraform Aws Eks Cluster
Terraform module for provisioning an EKS cluster
Stars: ✭ 256 (-25.58%)
Mutual labels:  aws, hcl
Spark Jupyter Aws
A guide on how to set up Jupyter with Pyspark painlessly on AWS EC2 clusters, with S3 I/O support
Stars: ✭ 259 (-24.71%)
Mutual labels:  aws, aws-ec2
Terraform Ecs Fargate
A Terraform template used for provisioning web application stacks on AWS ECS Fargate
Stars: ✭ 293 (-14.83%)
Mutual labels:  aws, hcl
Azure arc
Automated Azure Arc environments
Stars: ✭ 224 (-34.88%)
Mutual labels:  aws, hcl
Chaos Ssm Documents
Collection of AWS SSM Documents to perform Chaos Engineering experiments
Stars: ✭ 225 (-34.59%)
Mutual labels:  aws, aws-ec2
Terraform Aws Atlantis
Terraform configurations for running Atlantis on AWS Fargate. Github, Gitlab and BitBucket are supported
Stars: ✭ 246 (-28.49%)
Mutual labels:  aws, hcl
Terraform Aws Ecs Container Definition
Terraform module to generate well-formed JSON documents (container definitions) that are passed to the aws_ecs_task_definition Terraform resource
Stars: ✭ 217 (-36.92%)
Mutual labels:  aws, hcl
Cloudblock
Cloudblock automates deployment of secure ad-blocking for all of your devices - even when mobile. Step-by-step text and video guides included! Compatible clouds include AWS, Azure, Google Cloud, and Oracle Cloud. Cloudblock deploys Wireguard VPN, Pi-Hole DNS Ad-blocking, and DNS over HTTPS in a cloud provider - or locally - using Terraform and Ansible.
Stars: ✭ 257 (-25.29%)
Mutual labels:  aws, hcl
Kubenow
Deploy Kubernetes. Now!
Stars: ✭ 285 (-17.15%)
Mutual labels:  aws, hcl
Terraform Aws Gitlab Runner
Terraform module for AWS GitLab runners on ec2 (spot) instances
Stars: ✭ 292 (-15.12%)
Mutual labels:  aws, hcl
Elasticsearch Cloud Deploy
Deploy Elasticsearch on the cloud easily
Stars: ✭ 308 (-10.47%)
Mutual labels:  aws, hcl
Terraform Fargate Example
Example repository to run an ECS cluster on Fargate
Stars: ✭ 206 (-40.12%)
Mutual labels:  aws, hcl

AWS EC2 Instance Terraform module

Terraform module which creates EC2 instance(s) on AWS.

These types of resources are supported:

Terraform versions

Terraform 0.12. Pin module version to ~> v2.0. Submit pull-requests to master branch.

Terraform 0.11. Pin module version to ~> v1.0. Submit pull-requests to terraform011 branch.

Usage

module "ec2_cluster" {
  source                 = "terraform-aws-modules/ec2-instance/aws"
  version                = "~> 2.0"

  name                   = "my-cluster"
  instance_count         = 5

  ami                    = "ami-ebd02392"
  instance_type          = "t2.micro"
  key_name               = "user1"
  monitoring             = true
  vpc_security_group_ids = ["sg-12345678"]
  subnet_id              = "subnet-eddcdzz4"

  tags = {
    Terraform   = "true"
    Environment = "dev"
  }
}

Examples

Make an encrypted AMI for use

This module does not support encrypted AMI's out of the box however it is easy enough for you to generate one for use

This example creates an encrypted image from the latest ubuntu 16.04 base image.

resource "aws_ami_copy" "ubuntu-xenial-encrypted-ami" {
  name              = "ubuntu-xenial-encrypted-ami"
  description       = "An encrypted root ami based off ${data.aws_ami.ubuntu-xenial.id}"
  source_ami_id     = "${data.aws_ami.ubuntu-xenial.id}"
  source_ami_region = "eu-west-2"
  encrypted         = "true"

  tags {
    Name = "ubuntu-xenial-encrypted-ami"
  }
}

data "aws_ami" "encrypted-ami" {
  most_recent = true

  filter {
    name   = "name"
    values = ["ubuntu-xenial-encrypted"]
  }

  owners = ["self"]
}

data "aws_ami" "ubuntu-xenial" {
  most_recent = true

  filter {
    name   = "name"
    values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"]
  }

  owners      = ["099720109477"]
}

Notes

  • network_interface can't be specified together with vpc_security_group_ids, associate_public_ip_address, subnet_id. See basic example for details.
  • Changes in ebs_block_device argument will be ignored. Use aws_volume_attachment resource to attach and detach volumes from AWS EC2 instances. See this example.
  • One of subnet_id or subnet_ids is required. If both are provided, the value of subnet_id is prepended to the value of subnet_ids.

Requirements

Name Version
terraform >= 0.12.6
aws >= 2.65

Providers

Name Version
aws >= 2.65

Modules

No Modules.

Resources

Name
aws_instance

Inputs

Name Description Type Default Required
ami ID of AMI to use for the instance string n/a yes
associate_public_ip_address If true, the EC2 instance will have associated public IP address bool null no
cpu_credits The credit option for CPU usage (unlimited or standard) string "standard" no
disable_api_termination If true, enables EC2 Instance Termination Protection bool false no
ebs_block_device Additional EBS block devices to attach to the instance list(map(string)) [] no
ebs_optimized If true, the launched EC2 instance will be EBS-optimized bool false no
ephemeral_block_device Customize Ephemeral (also known as Instance Store) volumes on the instance list(map(string)) [] no
get_password_data If true, wait for password data to become available and retrieve it. bool false no
iam_instance_profile The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. string "" no
instance_count Number of instances to launch number 1 no
instance_initiated_shutdown_behavior Shutdown behavior for the instance string "" no
instance_type The type of instance to start string n/a yes
ipv6_address_count A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. number null no
ipv6_addresses Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface list(string) null no
key_name The key name to use for the instance string "" no
metadata_options Customize the metadata options of the instance map(string) {} no
monitoring If true, the launched EC2 instance will have detailed monitoring enabled bool false no
name Name to be used on all resources as prefix string n/a yes
network_interface Customize network interfaces to be attached at instance boot time list(map(string)) [] no
num_suffix_format Numerical suffix format used as the volume and EC2 instance name suffix string "-%d" no
placement_group The Placement Group to start the instance in string "" no
private_ip Private IP address to associate with the instance in a VPC string null no
private_ips A list of private IP address to associate with the instance in a VPC. Should match the number of instances. list(string) [] no
root_block_device Customize details about the root block device of the instance. See Block Devices below for details list(map(string)) [] no
source_dest_check Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. bool true no
subnet_id The VPC Subnet ID to launch in string "" no
subnet_ids A list of VPC Subnet IDs to launch in list(string) [] no
tags A mapping of tags to assign to the resource map(string) {} no
tenancy The tenancy of the instance (if the instance is running in a VPC). Available values: default, dedicated, host. string "default" no
use_num_suffix Always append numerical suffix to instance name, even if instance_count is 1 bool false no
user_data The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user_data_base64 instead. string null no
user_data_base64 Can be used instead of user_data to pass base64-encoded binary data directly. Use this instead of user_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption. string null no
volume_tags A mapping of tags to assign to the devices created by the instance at launch time map(string) {} no
vpc_security_group_ids A list of security group IDs to associate with list(string) null no

Outputs

Name Description
arn List of ARNs of instances
availability_zone List of availability zones of instances
credit_specification List of credit specification of instances
ebs_block_device_volume_ids List of volume IDs of EBS block devices of instances
id List of IDs of instances
instance_count Number of instances to launch specified as argument to this module
instance_state List of instance states of instances
ipv6_addresses List of assigned IPv6 addresses of instances
key_name List of key names of instances
metadata_options List of metadata options of instances
password_data List of Base-64 encoded encrypted password data for the instance
placement_group List of placement groups of instances
primary_network_interface_id List of IDs of the primary network interface of instances
private_dns List of private DNS names assigned to the instances. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC
private_ip List of private IP addresses assigned to the instances
public_dns List of public DNS names assigned to the instances. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC
public_ip List of public IP addresses assigned to the instances, if applicable
root_block_device_volume_ids List of volume IDs of root block devices of instances
security_groups List of associated security groups of instances
subnet_id List of IDs of VPC subnets of instances
tags List of tags of instances
volume_tags List of tags of volumes of instances
vpc_security_group_ids List of associated security groups of instances, if running in non-default VPC

Authors

Module managed by Anton Babenko.

License

Apache 2 Licensed. See LICENSE for full details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].