-
Notifications
You must be signed in to change notification settings - Fork 38
deploy infrastructure with terraform in AWS #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
agustinasierralima
wants to merge
4
commits into
galliot-us:master
Choose a base branch
from
xmartlabs:deploy-cloud-terraform
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| terraform { | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = "~> 3.27" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "aws" { | ||
| region = var.region | ||
| } | ||
|
|
||
| module "module-network-linux-web" { | ||
| source = "github.com/xmartlabs/terraform.git?ref=module-network-linux-web/modules/module-network-linux-web" | ||
| region = var.region | ||
| tags = var.tags | ||
| vpc = var.vpc | ||
| subnet_prefix = var.subnet_prefix | ||
| security_group = var.security_group | ||
| route_table = var.route_table | ||
| network_interface = var.network_interface | ||
| } | ||
|
|
||
| module "module-ec2-linux-web"{ | ||
| source = "github.com/xmartlabs/terraform.git?ref=module-network-linux-web/modules/module-ec2-linux-web" | ||
| region = var.region | ||
| amiid = var.amiid | ||
| tags= var.tags | ||
| id_network_interface= module.module-network-linux-web.network_interface_id | ||
| user_data_path= "user_data.tmpl" | ||
| key_name= var.key_name | ||
| ec2name = var.ec2name | ||
| size = var.size | ||
| root_disk = var.root_disk | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
|
|
||
| #If you don't specify the values from some variables, this takes the default values described in the variable.tf file. | ||
| #The variables region,key_name and amiid are required. | ||
|
|
||
| # Generics | ||
| region = | ||
|
|
||
| tags = | ||
|
|
||
| # Networking | ||
|
|
||
| vpc = | ||
|
|
||
| subnet_prefix = | ||
|
|
||
| security_group = | ||
|
|
||
| route_table = | ||
|
|
||
| network_interface = | ||
|
|
||
| # EC2 | ||
|
|
||
| ec2name = | ||
|
|
||
| key_name = | ||
|
|
||
| #We recomend use g4dn.xlarge size. | ||
| size = | ||
|
|
||
| #We recomend use [{ volume_size = "100",volume_type = "gp2"}] values. | ||
| root_disk = | ||
|
|
||
| #We recomend use "ami-012e9f6aa634f84f8", this ami have ndrivia drivers and gpu. | ||
| amiid = | ||
|
|
||
| # To be run after creation | ||
| user_data_path = | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #!/bin/bash | ||
| sudo yum update -y | ||
| sudo amazon-linux-extras install docker -y | ||
| sudo service docker start | ||
|
|
||
| #docker-ec2user | ||
|
|
||
| sudo groupadd docker | ||
| sudo gpasswd -a ec2-user docker | ||
| sudo usermod -aG docker ec2-user | ||
|
|
||
|
|
||
| sudo yum install nvidia* -y | ||
|
|
||
| distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ | ||
| && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo | ||
|
|
||
| sudo yum clean expire-cache | ||
|
|
||
| sudo systemctl restart docker | ||
|
|
||
| sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi | ||
agustinasierralima marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #Api | ||
| sudo yum install git -y | ||
| git clone https://github.com/neuralet/smart-social-distancing.git | ||
| cd smart-social-distancing | ||
| git fetch --tags | ||
| git checkout $(git tag | tail -1) | ||
| ./download-x86-openpifpaf-model.sh | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Generics | ||
| variable "region" { | ||
| description = "required - region" | ||
| } | ||
|
|
||
| variable "tags" { | ||
| description = "required - default important tags for resources" | ||
| default = [{ Project = "not created", State = "not created" }] | ||
| } | ||
|
|
||
| # Networking | ||
| variable "vpc" { | ||
| description = "The definition of vpc" | ||
| default = [{ name = "terraform_module_vpc", cidr_block = "10.0.0.0/16", instance_tenancy = "default", enable_dns_hostnames = true, enable_dns_support = true }] | ||
| } | ||
|
|
||
| variable "subnet_prefix" { | ||
| description = "The subnet prefix" | ||
| default = [{ name = "terraform_module_subnet", cidr_block = "10.0.1.0/24", availability_zone = "us-east-1a", map_public_ip_on_launch = true }] | ||
| } | ||
|
|
||
| variable "security_group" { | ||
| description = "security group definition" | ||
| default = [{ name = "terraform_module_security_group" }] | ||
| } | ||
|
|
||
| variable "route_table" { | ||
| description = "route table definition" | ||
| default = [{ name = "terraform_module_route_table", cidr_block = "0.0.0.0/0", ipv6_cidr_block = "::/0" }] | ||
| } | ||
|
|
||
| variable "network_interface" { | ||
| description = "network interface definition" | ||
| default = [{ name = "terraform_module_network_interface", private_ips = ["10.0.1.50"], device_index = 0 }] | ||
| } | ||
|
|
||
| # EC2 | ||
| variable "ec2name" { | ||
| description = "name for the EC2 instance" | ||
| default = "default-ec2name" | ||
| } | ||
| variable "key_name" { | ||
| description = "key to be used by the EC2" | ||
| } | ||
| variable "size" { | ||
| description = "instance type for the EC2" | ||
| default = "t2-micro" | ||
| } | ||
| variable "root_disk" { | ||
| description = "root disk definition" | ||
| default = [{ volume_size = "100", volume_type = "gp2" }] | ||
| } | ||
| variable "amiid" { | ||
| description = "amazon-linux" | ||
| } | ||
|
|
||
| # To be run after creation | ||
| variable "user_data_path" { | ||
| description = "User data file path" | ||
| default = "user_data.tmpl" | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.