- Create AWS ACC
- Open https://go.aws/3i6FQ66
- Click the "Create a free account" button
- Enter the root user email address and aws account name.
- They will send a verification code to the entered email, enter it to the form
- Enter the root password
- Enter your details, choose the personal for the "How do you plan to use AWS?"
- Enter your credit card details
- Enter your phone number, and choose to send the verification code via Text message (SMS)
- Enter the verification code received
- Choose the Basic support plan
- Click "Go to the AWS Management Console" button
- Open IAM service in the AWS console and create IAM user with Administrator privileges
- Put this user credentials to
~/.aws/credentials
on your laptop
[user1]
aws_access_key_id=AKIAI44QH8DHBEXAMPLE
aws_secret_access_key=je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY
- Download Terraform - https://www.terraform.io/downloads
- Clone this repo
git clone https://github.com/nomatterz/pnh
cd pnh
- There are default variables values (
variables.tf
file and also they are listed below here, inREADME.md
).
Also you can provide your own values and override defaults - file with custom variables shoud have extenstion*.tfvars
Repo contains sample variable file -ireland.tfvars
.
Specify your profile (user1
) to terraformprofile
variable either by overridding value inireland.tfvars
or in your custom variable file. - Adjust ddoser launch cmd if needed in
user_data_ddoser.sh
- Run
terraform init
terraform apply -var-file myfile.tfvars
- To launch instances in another region create
*.tfvars
file with needed values (available regions can be found here - https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html -us-east-1
,eu-central-1
, etc - To destroy AWS resources
terraform destroy -var-file myfile.tfvars
for new accounts you should request 32-64 vCPU
Name | Version |
---|---|
aws | ~> 3.0 |
Name | Version |
---|---|
aws | ~> 3.0 |
No modules.
Name | Type |
---|---|
aws_autoscaling_group.on_demand | resource |
aws_autoscaling_group.spot | resource |
aws_iam_instance_profile.profile | resource |
aws_iam_policy_attachment.attach | resource |
aws_iam_role.instance | resource |
aws_launch_template.base | resource |
aws_ami.amazon_linux2 | data source |
aws_subnets.default | data source |
aws_vpc.default | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
max_size | Max size for autoscaling groups. Both on-demand and spot. | number |
32 |
no |
min_size | Min size for autoscale groups. Both on-demand and spot | number |
0 |
no |
on_demand_desired_capacity | number of on-demand instances to launch | number |
2 |
no |
on_demand_instance_type | on-demand instance type to use | string |
"t3.micro" |
no |
profile | Profile for AWS credentials | string |
n/a | yes |
region | AWS Region | string |
n/a | yes |
spot_desired_capacity | number of spot instances to launch | number |
2 |
no |
spot_instance_types | list of spot instance types to launch. defaults to empty | list(string) |
[] |
no |
spot_max_price | max price for spot instances. same for all the types | string |
"0.004" |
no |
user_data_filename | name of file that will be used as ec2 userdata script | string |
"user_data_ddoser.sh" |
no |
No outputs.