{"id":21368090,"url":"https://github.com/tokarev-artem/auto-ec2-setup","last_synced_at":"2026-04-10T13:31:40.643Z","repository":{"id":237998480,"uuid":"795663355","full_name":"tokarev-artem/auto-ec2-setup","owner":"tokarev-artem","description":"This project was created for automatic and 5 minutes setup ec2 instances for hosting php applications","archived":false,"fork":false,"pushed_at":"2025-06-04T16:49:46.000Z","size":23,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T22:22:33.769Z","etag":null,"topics":["ansible","aws","ec2","mysql","nginx","php","terraform"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tokarev-artem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-03T18:55:13.000Z","updated_at":"2025-06-04T20:40:29.000Z","dependencies_parsed_at":"2024-05-03T20:23:35.499Z","dependency_job_id":"2dc39ee0-12d7-4b2d-95e9-052e6dce1196","html_url":"https://github.com/tokarev-artem/auto-ec2-setup","commit_stats":null,"previous_names":["realartemiy/auto-ec2-setup","tokarev-artem/auto-ec2-setup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tokarev-artem/auto-ec2-setup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokarev-artem%2Fauto-ec2-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokarev-artem%2Fauto-ec2-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokarev-artem%2Fauto-ec2-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokarev-artem%2Fauto-ec2-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tokarev-artem","download_url":"https://codeload.github.com/tokarev-artem/auto-ec2-setup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokarev-artem%2Fauto-ec2-setup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31645231,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","aws","ec2","mysql","nginx","php","terraform"],"created_at":"2024-11-22T07:22:42.647Z","updated_at":"2026-04-10T13:31:40.376Z","avatar_url":"https://github.com/tokarev-artem.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- BEGIN_AUTOMATED_TF_DOCS_BLOCK --\u003e\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_aws\"\u003e\u003c/a\u003e [aws](#requirement\\_aws) | ~\u003e 5.0 |\n## Usage\nBasic usage of this module is as follows:\n```hcl\n  module \"ec2\" {\n    source                      = \"../module\"\n    instance_type               = \"t3.medium\"\n    vpc_id                      = \"vpc-abcdef123456\"\n    subnet_id                   = \"subnet-abcdef123\"\n    allow_ingress_ip            = \"0.0.0.0/0\"\n    create_iam_instance_profile = true\n    php_version                 = \"8.2\"\n    domain_name                 = \"example.com\"\n    root_block_device = [\n      {\n        encrypted   = true\n        volume_type = \"gp3\"\n        throughput  = 200\n        volume_size = 50\n      },\n    ]\n  }\n```\nThis project was created for 5 minutes ec2 instance setup with installed php, mysql, nginx, backups.\nTo run this project - you need to install [terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) \n\nFull working example you can find in terraform/example.com directory. Ajust parameters in main.tf and backend.tf files and run `terraform init` and `terraform apply`\n\nAfter applying the Terraform configuration, an SSH key will be generated and saved in the directory from which you applied the code.\n\nTo connect to the server, use the following SSH command, replacing `\u003cserver_ip\u003e` with the IP address of the server:\n```bash\nssh \u003cserver_ip\u003e -l ubuntu -i example.com.pem\n```\n\nAfter the server created - it will run self-setup ansible script used EC2 [user data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#user-data-shell-scripts)\n\n## Ansible installation: \n- The PHP version to set up can be defined by the php_version parameter. Supported versions include 8.1, 8.2, and 8.3.\n- The php.ini file will be configured to implement basic security changes.\n- MySQL root and user password will be generated automatically, root password will be saved to `/root/.my.cnf`, user password will be saved to `/var/www/vhosts/example.com/index.php`.\n- A MySQL backup script will be installed to `/root/bin/mysql-maint.sh` and added as a cronjob to execute at midnight.\n- An Nginx configuration file will be created at /etc/nginx/conf.d/example.com.conf, and the virtual host will be served from /var/www/vhosts/example.com/.\n- After the autosetup is finished, you can point the DNS of your example.com and www.example.com to the IP address and issue HTTPS certificates by running certbot --nginx.\n\n## Debug: \nIf something was not configured properly - you can review ansible log in /var/log/cloud-init-output.log.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [aws_eip.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n| [aws_key_pair.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/key_pair) | resource |\n| [local_file.cloud_pem](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource |\n| [tls_private_key.this](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |\n| [aws_ami.ubuntu](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source |\n| [template_file.init](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source |\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_allow_ingress_ip\"\u003e\u003c/a\u003e [allow\\_ingress\\_ip](#input\\_allow\\_ingress\\_ip) | IP address to allow ssh access to | `string` | n/a | yes |\n| \u003ca name=\"input_create_iam_instance_profile\"\u003e\u003c/a\u003e [create\\_iam\\_instance\\_profile](#input\\_create\\_iam\\_instance\\_profile) | Determines whether an IAM instance profile is created or to use an existing IAM instance profile | `bool` | `false` | no |\n| \u003ca name=\"input_domain_name\"\u003e\u003c/a\u003e [domain\\_name](#input\\_domain\\_name) | Domain name to init instance for | `string` | n/a | yes |\n| \u003ca name=\"input_instance_type\"\u003e\u003c/a\u003e [instance\\_type](#input\\_instance\\_type) | The instance type | `string` | `\"t3.medium\"` | no |\n| \u003ca name=\"input_php_version\"\u003e\u003c/a\u003e [php\\_version](#input\\_php\\_version) | PHP version to install | `string` | `\"8.1\"` | no |\n| \u003ca name=\"input_root_block_device\"\u003e\u003c/a\u003e [root\\_block\\_device](#input\\_root\\_block\\_device) | Root block device parameters | `any` | n/a | yes |\n| \u003ca name=\"input_subnet_id\"\u003e\u003c/a\u003e [subnet\\_id](#input\\_subnet\\_id) | VPC subnet id to create the instance in | `any` | n/a | yes |\n| \u003ca name=\"input_vpc_id\"\u003e\u003c/a\u003e [vpc\\_id](#input\\_vpc\\_id) | VPC ID to create instance and security group in | `string` | n/a | yes |\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_ec2_instance_id\"\u003e\u003c/a\u003e [ec2\\_instance\\_id](#output\\_ec2\\_instance\\_id) | EC2 instance ID |\n| \u003ca name=\"output_ec2_instance_ip\"\u003e\u003c/a\u003e [ec2\\_instance\\_ip](#output\\_ec2\\_instance\\_ip) | EC2 public IP |\n| \u003ca name=\"output_security_group_id\"\u003e\u003c/a\u003e [security\\_group\\_id](#output\\_security\\_group\\_id) | EC2 instance security group ID |\n| \u003ca name=\"output_ssh_key_name\"\u003e\u003c/a\u003e [ssh\\_key\\_name](#output\\_ssh\\_key\\_name) | SSH key name |\n\u003c!-- END_AUTOMATED_TF_DOCS_BLOCK --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokarev-artem%2Fauto-ec2-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftokarev-artem%2Fauto-ec2-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokarev-artem%2Fauto-ec2-setup/lists"}