Skip to content

Commit

Permalink
feat: added key-pair and spot instance testing
Browse files Browse the repository at this point in the history
  • Loading branch information
theprashantyadav committed Jun 21, 2023
1 parent 00b23c4 commit fed8d3e
Showing 1 changed file with 90 additions and 65 deletions.
155 changes: 90 additions & 65 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,62 +44,49 @@ usage: |-
### Basic Example
```hcl
module "ec2" {
source = "clouddrove/ec2/aws"
source = "clouddrove/ec2/aws"
name = "ec2"
environment = "test"
label_order = ["name", "environment"]
## security-group
vpc_id = module.vpc.vpc_id
ssh_allowed_ip = ["0.0.0.0/0"]
ssh_allowed_ports = [22]
#instance
instance_enabled = true
instance_count = 2
ami = "ami-08d658f84a6d84a80"
instance_type = "t2.nano"
monitoring = false
tenancy = "default"
instance_count = 1
ami = "ami-08d658f84a6d84a80"
instance_type = "c4.xlarge"
#Networking
vpc_security_group_ids_list = [module.ssh.security_group_ids, module.http-https.security_group_ids]
subnet_ids = tolist(module.public_subnets.public_subnet_id)
assign_eip_address = true
associate_public_ip_address = true
subnet_ids = tolist(module.public_subnets.public_subnet_id)
#Keypair
key_name = module.keypair.name
public_key = "ssh-rsa ArJh5/gxz7sbSSseLd+ldHEOM3+lajUSGqWk3Bw/NgygEf1Kgw7gyK3jsTVVcokhK3TDuR3pi4u2QDR2tvLXddPKd37a2S7rjeqecw+XRW9559zKaR7RJJfjO1u1Onc2tgA3y0btdju2bcYBtFkRVOLwpog8CvslYEDV1Vf9HNeh9A3yOS6Pkjq6gDMrsUVF89ps3zuLmdVBIlCOnJDkwHK71lKihGKdkeXEtAj0aOQzAJsIpDFXz7vob9OiA/fb2T3t4R1EwEsPEnYVczKMsqUyqa+EE36bItcZHQyCPVN7+bRJyJpPcrfrsAa4yMtiHUUiecPdL/6HYwGHxxl2UQR5NE4NR35NI86Q+q1kNOc5VctxxQOTHBwKHaGvKLk4c5gHXaEl8yyYL0wVkL00KYx3GCh1LvRdQ"
#IAM
instance_profile_enabled = true
iam_instance_profile = module.iam-role.name
iam_instance_profile = module.iam-role.name
#Root Volume
root_block_device = [
{
volume_type = "gp2"
volume_size = 15
delete_on_termination = true
kms_key_id = module.kms_key.key_arn
}
]
#EBS Volume
ebs_optimized = false
ebs_volume_enabled = false
ebs_volume_type = "gp2"
ebs_volume_size = 30
#DNS
dns_enabled = false
dns_zone_id = "Z1XJD7SSBKXLC1"
hostname = "ec2"
#Tags
instance_tags = { "snapshot" = true }
# Metadata
metadata_http_tokens_required = "optional"
metadata_http_endpoint_enabled = "enabled"
metadata_http_put_response_hop_limit = 2
}
}
```
### ebs_mount
Expand All @@ -110,57 +97,95 @@ usage: |-
environment = "test"
label_order = ["name", "environment"]
## security group
vpc_id = module.vpc.vpc_id
ssh_allowed_ip = ["0.0.0.0/0"]
ssh_allowed_ports = [22]
#Instance
instance_enabled = true
instance_count = 2
ami = "ami-08d658f84a6d84a80"
instance_type = "t2.nano"
monitoring = false
tenancy = "default"
instance_count = 1
ami = "ami-08d658f84a6d84a80"
instance_type = "t2.nano"
#Keypair
key_name = module.keypair.name
public_key = "HEOM3+lajUSGqWk3Bw/NgygEf1Kgw7gyK3jsTVVcokhK3TDuR3pi4u2QDR2tvLXddPKd37a2S7rjeqecw+XRW9559zKaR7RJJfjO1u1Onc2tgA3y0btdju2bcYBtFkRVOLwpog8CvslYEDLmdVBIlCOnJDkwHK71lKihGKdkeXEtAj0aOQzAJsIpDFXz7vob9OiA/fb2T3t4R1EwEsPEnYVczKMsqUyqa+EE36bItcZHQyCPVN7+bRJyJpPcrfrsAa4yMtiHUUiecPdL/6HYwGHxA5rUX3uD2UBm6sbGBH00ZCj6yUxl2UQR5NE4NR35NI86Q+q1kNOc5VctxxQOTHBwKHaGvKLk4c5gHXaEl8yyYL0wVkL00KYx3GCh1"
#Networking
vpc_security_group_ids_list = [module.ssh.security_group_ids, module.http-https.security_group_ids]
subnet_ids = tolist(module.public_subnets.public_subnet_id)
assign_eip_address = true
associate_public_ip_address = true
subnet_ids = tolist(module.public_subnets.public_subnet_id)
#IAM
instance_profile_enabled = true
iam_instance_profile = module.iam-role.name
iam_instance_profile = module.iam-role.name
#Root Volume
root_block_device = [
{
volume_type = "gp2"
volume_size = 15
delete_on_termination = true
kms_key_id = module.kms_key.key_arn
}
]
#EBS Volume
ebs_optimized = false
ebs_volume_enabled = true
ebs_volume_type = "gp2"
ebs_volume_size = 30
#DNS
dns_enabled = false
dns_zone_id = "Z1XJD7SSBKXLC1"
hostname = "ec2"
#Tags
instance_tags = { "snapshot" = true }
# Metadata
metadata_http_tokens_required = "optional"
metadata_http_endpoint_enabled = "enabled"
metadata_http_put_response_hop_limit = 2
#Mount EBS With User Data
user_data = file("user-data.sh")
}
```
### spot-instance
```hcl
module "spot-ec2" {
source = "./../../"
name = "ec2"
environment = "test"
label_order = ["name", "environment"]
## security-group
vpc_id = module.vpc.vpc_id
ssh_allowed_ip = ["0.0.0.0/0"]
ssh_allowed_ports = [22]
#Keypair
public_key = "h5/gxz7sbSSseLd+ldHEOM3+lajUSGqWk3Bw/NgygEf1Kgw7gyK3jsTVVcokhK3TDuR3pi4u2QDR2tvLXddPKd37a2S7rjeqecw+XRW9559zKaR7RJJfjO1u1Onc2tgA3y0btdju2bcYBtFkRVOLwpog8CvslYEDV1Vf9HNeh9A3yOS6Pkjq6gDMrsUVF89ps3zuLmdVBIlCOnJDkwHK71lKihGKdkeXEtAj0aOQzAJsIpDFXz7vob9OiA/fb2T3t4R1EwEsPEnYVczKMsqUyqa+EE36bItcZHQyCPVN7+bRJyJpPcrfrsAa4yMtiHUUiecPdL/6HYwGHxA5rUX3uD2UBm6sbGBHxQOTHBwKHaGvKLk4c5gHXaEl8yyYL0wVkL00KYx3GCh1LvRdQL8fvzImBCNg"
# Spot-instance
spot_price = "0.3"
spot_wait_for_fulfillment = true
spot_type = "persistent"
spot_instance_interruption_behavior = "terminate"
spot_instance_enabled = true
spot_instance_count = 1
spot_ami = "ami-08d658f84a6d84a80"
instance_type = "c4.xlarge"
#Networking
subnet_ids = tolist(module.public_subnets.public_subnet_id)
#IAM
iam_instance_profile = module.iam-role.name
#Root Volume
root_block_device = [
{
volume_type = "gp2"
volume_size = 15
delete_on_termination = true
}
]
#EBS Volume
ebs_volume_enabled = true
ebs_volume_type = "gp2"
ebs_volume_size = 30
#Tags
spot_instance_tags = { "snapshot" = true }
}
```

0 comments on commit fed8d3e

Please sign in to comment.