Deploy simple web server provided by nginx in debian 10 to amazon elastic compute cloud using terraform.
-
prerequisites installation
- create AWS Account
- generate access key
- install AWS CLI
- install Terraform
- create AWS Account
-
environment configuration
mkdir -p ~/.aws cat <<EOS > ~/.aws/config [default] region = us-east-1 EOS cat <<EOS > ~/.aws/credentials [default] aws_access_key_id = <your AWS access key ID> aws_secret_access_key = <your AWS secret access key> EOS # secure the files chmod 0600 ~/.aws/config ~/.aws/credentials
-
clone this repository and
cd
into it -
create SSH key pair
ssh-keygen -t rsa -b 4096 -C "terraform" -f ./ssh/key
-
configure terraform variables (set your custom values)
# create variable file cp .terraform.tfvars.example terraform.tfvars # set custom variable values vi terraform.tfvars
-
deployment
# download module(s) terraform init # deploy terraform apply