├── 1. aws_tf_vpc_basics ├── datasources.tf ├── main.tf ├── outputs.tf ├── providers.tf └── userdata.tpl ├── 2. aws_tf_rds_secrets_manager ├── kms_key.tf ├── main.tf ├── rds.tf ├── secrets_manager.tf └── variables.tf ├── 3. aws_tf_ec2_ebs_userdata ├── cloudinit.tf ├── instance.tf ├── key.tf ├── provider.tf ├── scripts │ ├── init.cfg │ └── volumes.sh ├── securitygroup.tf ├── vars.tf └── vpc.tf ├── 4. aws_tf_ec2_s3 ├── iam.tf ├── instance.tf ├── key.tf ├── output.tf ├── provider.tf ├── s3.tf ├── securitygroup.tf ├── vars.tf ├── versions.tf └── vpc.tf ├── 5. aws_tf_ecs_fargate ├── Load-Balancer.tf ├── Security-Group.tf ├── Target-Group.tf ├── backend.tf ├── ecs-cluster.tf ├── ecs-service.tf ├── ecs-taskdefiniton.tf ├── iam-policy.json ├── iam-policy.tf ├── iam-role.json ├── iam-role.tf ├── output.tf ├── provider.tf └── vpc.tf ├── 6. aws_tf_api_gateway_lambda_integration ├── API-GW.tf ├── iam-policy.json ├── iam-policy.tf ├── iam-role.tf ├── lambda-function.tf ├── output.tf ├── provider.tf └── variables.tf ├── LICENSE └── README.md /1. aws_tf_vpc_basics/datasources.tf: -------------------------------------------------------------------------------- 1 | data "aws_ami" "example" { 2 | most_recent = true 3 | owners = ["099720109477"] 4 | 5 | filter { 6 | name = "name" 7 | values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"] 8 | } 9 | } 10 | 11 | resource "aws_instance" "MyEc2Instance" { 12 | ami = data.aws_ami.example.id 13 | instance_type = "t2.micro" 14 | key_name = aws_key_pair.auth.id 15 | vpc_security_group_ids = ["${aws_security_group.allow_sgs.id}"] 16 | subnet_id = aws_subnet.main.id 17 | user_data = file("${path.module}/userdata.tpl") 18 | 19 | root_block_device { 20 | volume_size = 10 21 | } 22 | 23 | tags = { 24 | Name = "dev-node" 25 | } 26 | } -------------------------------------------------------------------------------- /1. aws_tf_vpc_basics/main.tf: -------------------------------------------------------------------------------- 1 | 2 | resource "aws_vpc" "main" { 3 | cidr_block = "10.0.0.0/16" 4 | enable_dns_hostnames = true 5 | enable_dns_support = true 6 | 7 | tags = { 8 | Name = "dev" 9 | } 10 | } 11 | 12 | resource "aws_subnet" "main" { 13 | vpc_id = aws_vpc.main.id 14 | cidr_block = "10.0.1.0/24" 15 | map_public_ip_on_launch = true 16 | availability_zone = "us-east-1a" 17 | 18 | tags = { 19 | Name = "dev-public" 20 | } 21 | } 22 | 23 | resource "aws_internet_gateway" "gw" { 24 | vpc_id = aws_vpc.main.id 25 | 26 | tags = { 27 | Name = "main" 28 | } 29 | } 30 | 31 | resource "aws_route_table" "rt" { 32 | vpc_id = aws_vpc.main.id 33 | 34 | tags = { 35 | Name = "dev-public-rt" 36 | } 37 | } 38 | 39 | resource "aws_route" "r" { 40 | route_table_id = aws_route_table.rt.id 41 | destination_cidr_block = "0.0.0.0/0" 42 | gateway_id = aws_internet_gateway.gw.id 43 | depends_on = [aws_route_table.rt] 44 | } 45 | 46 | resource "aws_route_table_association" "rt-association" { 47 | subnet_id = aws_subnet.main.id 48 | route_table_id = aws_route_table.rt.id 49 | } 50 | 51 | locals { 52 | ports_in = [ 53 | 443, 54 | 80, 55 | 22 56 | ] 57 | ports_out = [ 58 | 0 59 | ] 60 | } 61 | 62 | resource "aws_security_group" "allow_sgs" { 63 | name = "dev_sg" 64 | description = "Allow inbound traffic" 65 | vpc_id = aws_vpc.main.id 66 | 67 | dynamic "ingress" { 68 | for_each = toset(local.ports_in) 69 | content { 70 | description = "HTTPS from VPC" 71 | from_port = ingress.value 72 | to_port = ingress.value 73 | protocol = "tcp" 74 | cidr_blocks = ["0.0.0.0/0"] 75 | } 76 | } 77 | 78 | dynamic "egress" { 79 | for_each = toset(local.ports_out) 80 | content { 81 | from_port = egress.value 82 | to_port = egress.value 83 | protocol = "-1" 84 | cidr_blocks = ["0.0.0.0/0"] 85 | } 86 | } 87 | 88 | tags = { 89 | Name = "allow_sgs" 90 | } 91 | } 92 | 93 | resource "aws_key_pair" "auth" { 94 | key_name = "mykey" 95 | public_key = file("mykey.pub") 96 | } 97 | -------------------------------------------------------------------------------- /1. aws_tf_vpc_basics/outputs.tf: -------------------------------------------------------------------------------- 1 | output "dev_id" { 2 | value = aws_instance.MyEc2Instance.public_ip 3 | } -------------------------------------------------------------------------------- /1. aws_tf_vpc_basics/providers.tf: -------------------------------------------------------------------------------- 1 | # this provides configuration to aws 2 | terraform { 3 | required_providers { 4 | aws = { 5 | source = "hashicorp/aws" 6 | } 7 | } 8 | } 9 | 10 | # provides the information to access aws specifically 11 | provider "aws" { 12 | shared_credentials_files = ["~/.aws/credentials"] 13 | profile = "default" 14 | } 15 | -------------------------------------------------------------------------------- /1. aws_tf_vpc_basics/userdata.tpl: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo su 3 | apt update 4 | apt install -y apache2 5 | echo "Hello from AWS Cloud Demos!!!" > /var/www/html/index.html -------------------------------------------------------------------------------- /2. aws_tf_rds_secrets_manager/kms_key.tf: -------------------------------------------------------------------------------- 1 | # KMS key used by Secrets Manager for RDS 2 | resource "aws_kms_key" "default" { 3 | description = "KMS key for RDS" 4 | deletion_window_in_days = 7 5 | is_enabled = true 6 | enable_key_rotation = true 7 | 8 | tags = { 9 | Name = var.default_tag 10 | } 11 | } -------------------------------------------------------------------------------- /2. aws_tf_rds_secrets_manager/main.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_providers { 3 | aws = { 4 | source = "hashicorp/aws" 5 | version = "5.9.0" 6 | } 7 | } 8 | backend "s3" { 9 | bucket = "my-rds-secrets-bucket" 10 | key = "rds_tf_state/terraform.tfstate" 11 | region = "us-east-1" 12 | } 13 | } 14 | 15 | provider "aws" { 16 | region = "us-east-1" 17 | } -------------------------------------------------------------------------------- /2. aws_tf_rds_secrets_manager/rds.tf: -------------------------------------------------------------------------------- 1 | data "aws_secretsmanager_secret" "example" { 2 | name = "rds_admin6" 3 | depends_on = [ 4 | aws_secretsmanager_secret.example 5 | ] 6 | } 7 | 8 | data "aws_secretsmanager_secret_version" "secret" { 9 | secret_id = data.aws_secretsmanager_secret.example.id 10 | } 11 | 12 | resource "aws_db_instance" "default" { 13 | identifier = "my-database" 14 | allocated_storage = var.allocated_storage 15 | storage_type = "gp2" 16 | engine = var.engine 17 | engine_version = var.engine_version 18 | instance_class = var.instance_class 19 | username = "Admin" 20 | password = data.aws_secretsmanager_secret_version.secret.secret_string 21 | parameter_group_name = "default.mariadb10.4" 22 | skip_final_snapshot = true 23 | publicly_accessible = true 24 | multi_az = false 25 | storage_encrypted = true 26 | backup_retention_period = 7 27 | 28 | tags = { 29 | Name = var.default_tag 30 | } 31 | } -------------------------------------------------------------------------------- /2. aws_tf_rds_secrets_manager/secrets_manager.tf: -------------------------------------------------------------------------------- 1 | resource "random_password" "password" { 2 | length = 16 3 | special = true 4 | override_special = "_!%^" 5 | } 6 | 7 | resource "aws_secretsmanager_secret" "example" { 8 | kms_key_id = aws_kms_key.default.key_id 9 | name = "rds_admin6" 10 | description = "RDS Admin password" 11 | recovery_window_in_days = 14 12 | 13 | tags = { 14 | Name = var.default_tag 15 | } 16 | } 17 | 18 | resource "aws_secretsmanager_secret_version" "secret" { 19 | secret_id = aws_secretsmanager_secret.example.id 20 | secret_string = random_password.password.result 21 | } -------------------------------------------------------------------------------- /2. aws_tf_rds_secrets_manager/variables.tf: -------------------------------------------------------------------------------- 1 | variable "allocated_storage" { 2 | description = "The amount of storage to allocate" 3 | type = number 4 | default = 20 5 | sensitive = true 6 | } 7 | 8 | variable "engine" { 9 | description = "The database engine to use" 10 | type = string 11 | default = "mariadb" 12 | } 13 | 14 | variable "engine_version" { 15 | description = "The engine version to use" 16 | type = string 17 | default = "10.4.25" 18 | } 19 | 20 | variable "instance_class" { 21 | description = "The instance class to use" 22 | type = string 23 | default = "db.t4g.small" 24 | } 25 | 26 | variable "default_tag" { 27 | type = string 28 | description = "A default tag to add to everything" 29 | default = "terraform_aws_rds_secrets_manager" 30 | } -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/cloudinit.tf: -------------------------------------------------------------------------------- 1 | # Define a cloud-init configuration data source named "cloudinit-example" 2 | data "cloudinit_config" "cloudinit-example" { 3 | # Specify options for cloud-init 4 | gzip = false 5 | base64_encode = false 6 | 7 | # Define the first part of the cloud-init configuration 8 | part { 9 | filename = "init.cfg" 10 | content_type = "text/cloud-config" 11 | # Use a template file to generate content, passing the AWS region as a variable 12 | content = templatefile("scripts/init.cfg", { 13 | REGION = var.AWS_REGION 14 | }) 15 | } 16 | 17 | # Define the second part of the cloud-init configuration 18 | part { 19 | content_type = "text/x-shellscript" 20 | # Use a template file to generate content, passing the instance device name as a variable 21 | content = templatefile("scripts/volumes.sh", { 22 | DEVICE = var.INSTANCE_DEVICE_NAME 23 | }) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/instance.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "example" { 2 | ami = var.AMIS[var.AWS_REGION] 3 | instance_type = "t2.micro" 4 | 5 | # the VPC subnet 6 | subnet_id = aws_subnet.main-public-1.id 7 | 8 | # the security group 9 | vpc_security_group_ids = [aws_security_group.allow-ssh.id] 10 | 11 | # the public SSH key 12 | key_name = aws_key_pair.mykeypair.key_name 13 | 14 | # user data 15 | user_data = data.cloudinit_config.cloudinit-example.rendered 16 | } 17 | 18 | resource "aws_ebs_volume" "ebs-volume-1" { 19 | availability_zone = "us-east-1a" 20 | size = 20 21 | type = "gp2" 22 | tags = { 23 | Name = "extra volume data" 24 | } 25 | } 26 | 27 | resource "aws_volume_attachment" "ebs-volume-1-attachment" { 28 | device_name = var.INSTANCE_DEVICE_NAME 29 | volume_id = aws_ebs_volume.ebs-volume-1.id 30 | instance_id = aws_instance.example.id 31 | skip_destroy = true # skip destroy to avoid issues with terraform destroy 32 | } 33 | 34 | -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/key.tf: -------------------------------------------------------------------------------- 1 | resource "aws_key_pair" "mykeypair" { 2 | key_name = "mykeypair" 3 | public_key = file(var.PATH_TO_PUBLIC_KEY) 4 | } 5 | 6 | -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/provider.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_providers { 3 | aws = { 4 | source = "hashicorp/aws" 5 | } 6 | } 7 | backend "s3" { 8 | bucket = "my-rds-secrets-bucket" 9 | key = "rds_tf_state/terraform.tfstate" 10 | region = "us-east-1" 11 | } 12 | } 13 | 14 | provider "aws" { 15 | region = var.AWS_REGION 16 | } -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/scripts/init.cfg: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | # Update package repositories during initialization 4 | repo_update: true 5 | 6 | # Upgrade all packages to their latest versions 7 | repo_upgrade: all 8 | 9 | # Install the Logical Volume Manager (LVM2) package 10 | packages: 11 | - lvm2 12 | 13 | # Redirect all output to both console and append to /var/log/cloud-init-output.log 14 | output: 15 | all: '| tee -a /var/log/cloud-init-output.log' 16 | -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/scripts/volumes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Enable debugging and exit on error 4 | set -ex 5 | 6 | # Activate volume groups 7 | vgchange -ay 8 | 9 | # Check the file system type of the specified device 10 | DEVICE_FS=`blkid -o value -s TYPE ${DEVICE} || echo ""` 11 | if [ "`echo -n $DEVICE_FS`" == "" ] ; then 12 | # Wait for the device to be attached and format it if not formatted 13 | DEVICENAME=`echo "${DEVICE}" | awk -F '/' '{print $3}'` 14 | DEVICEEXISTS='' 15 | 16 | # Loop to verify device attachment 17 | while [[ -z $DEVICEEXISTS ]]; do 18 | echo "verify $DEVICENAME" 19 | DEVICEEXISTS=`lsblk |grep "$DEVICENAME" |wc -l` 20 | if [[ $DEVICEEXISTS != "1" ]]; then 21 | sleep 15 22 | fi 23 | done 24 | 25 | # Ensure the device file in /dev/ exists within a time limit 26 | count=0 27 | until [[ -e ${DEVICE} || "$count" == "60" ]]; do 28 | sleep 5 29 | count=$(expr $count + 1) 30 | done 31 | 32 | # Initialize physical volume, create volume group, and logical volume 33 | pvcreate ${DEVICE} 34 | vgcreate data ${DEVICE} 35 | lvcreate --name volume1 -l 100%FREE data 36 | 37 | # Create a file system on the volume 38 | mkfs.ext4 /dev/data/volume1 39 | fi 40 | 41 | # Create directory /data if it doesn't exist 42 | mkdir -p /data 43 | 44 | # Add entry to /etc/fstab for mounting at boot 45 | echo '/dev/data/volume1 /data ext4 defaults 0 0' >> /etc/fstab 46 | 47 | # Mount /data 48 | mount /data 49 | 50 | # Install Docker 51 | curl https://get.docker.com | bash 52 | 53 | # End of script 54 | -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/securitygroup.tf: -------------------------------------------------------------------------------- 1 | resource "aws_security_group" "allow-ssh" { 2 | vpc_id = aws_vpc.main.id 3 | name = "allow-ssh" 4 | description = "security group that allows ssh and all egress traffic" 5 | egress { 6 | from_port = 0 7 | to_port = 0 8 | protocol = "-1" 9 | cidr_blocks = ["0.0.0.0/0"] 10 | } 11 | 12 | ingress { 13 | from_port = 22 14 | to_port = 22 15 | protocol = "tcp" 16 | cidr_blocks = ["0.0.0.0/0"] 17 | } 18 | tags = { 19 | Name = "allow-ssh" 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/vars.tf: -------------------------------------------------------------------------------- 1 | variable "AWS_REGION" { 2 | default = "us-east-1" 3 | } 4 | 5 | variable "PATH_TO_PRIVATE_KEY" { 6 | default = "mykey" 7 | } 8 | 9 | variable "PATH_TO_PUBLIC_KEY" { 10 | default = "mykey.pub" 11 | } 12 | 13 | variable "AMIS" { 14 | type = map(string) 15 | default = { 16 | us-east-1 = "ami-0b0ea68c435eb488d" 17 | } 18 | } 19 | 20 | variable "INSTANCE_DEVICE_NAME" { 21 | default = "/dev/xvdh" 22 | } 23 | 24 | -------------------------------------------------------------------------------- /3. aws_tf_ec2_ebs_userdata/vpc.tf: -------------------------------------------------------------------------------- 1 | # Internet VPC 2 | resource "aws_vpc" "main" { 3 | cidr_block = "10.0.0.0/16" 4 | instance_tenancy = "default" 5 | enable_dns_support = "true" 6 | enable_dns_hostnames = "true" 7 | tags = { 8 | Name = "main" 9 | } 10 | } 11 | 12 | # Subnets 13 | resource "aws_subnet" "main-public-1" { 14 | vpc_id = aws_vpc.main.id 15 | cidr_block = "10.0.1.0/24" 16 | map_public_ip_on_launch = "true" 17 | availability_zone = "us-east-1a" 18 | 19 | tags = { 20 | Name = "main-public-1" 21 | } 22 | } 23 | 24 | resource "aws_subnet" "main-public-2" { 25 | vpc_id = aws_vpc.main.id 26 | cidr_block = "10.0.2.0/24" 27 | map_public_ip_on_launch = "true" 28 | availability_zone = "us-east-1b" 29 | 30 | tags = { 31 | Name = "main-public-2" 32 | } 33 | } 34 | 35 | resource "aws_subnet" "main-public-3" { 36 | vpc_id = aws_vpc.main.id 37 | cidr_block = "10.0.3.0/24" 38 | map_public_ip_on_launch = "true" 39 | availability_zone = "us-east-1c" 40 | 41 | tags = { 42 | Name = "main-public-3" 43 | } 44 | } 45 | 46 | resource "aws_subnet" "main-private-1" { 47 | vpc_id = aws_vpc.main.id 48 | cidr_block = "10.0.4.0/24" 49 | map_public_ip_on_launch = "false" 50 | availability_zone = "us-east-1a" 51 | 52 | tags = { 53 | Name = "main-private-1" 54 | } 55 | } 56 | 57 | resource "aws_subnet" "main-private-2" { 58 | vpc_id = aws_vpc.main.id 59 | cidr_block = "10.0.5.0/24" 60 | map_public_ip_on_launch = "false" 61 | availability_zone = "us-east-1b" 62 | 63 | tags = { 64 | Name = "main-private-2" 65 | } 66 | } 67 | 68 | resource "aws_subnet" "main-private-3" { 69 | vpc_id = aws_vpc.main.id 70 | cidr_block = "10.0.6.0/24" 71 | map_public_ip_on_launch = "false" 72 | availability_zone = "us-east-1c" 73 | 74 | tags = { 75 | Name = "main-private-3" 76 | } 77 | } 78 | 79 | # Internet GW 80 | resource "aws_internet_gateway" "main-gw" { 81 | vpc_id = aws_vpc.main.id 82 | 83 | tags = { 84 | Name = "main" 85 | } 86 | } 87 | 88 | # route tables 89 | resource "aws_route_table" "main-public" { 90 | vpc_id = aws_vpc.main.id 91 | route { 92 | cidr_block = "0.0.0.0/0" 93 | gateway_id = aws_internet_gateway.main-gw.id 94 | } 95 | 96 | tags = { 97 | Name = "main-public-1" 98 | } 99 | } 100 | 101 | # route associations public 102 | resource "aws_route_table_association" "main-public-1-a" { 103 | subnet_id = aws_subnet.main-public-1.id 104 | route_table_id = aws_route_table.main-public.id 105 | } 106 | 107 | resource "aws_route_table_association" "main-public-2-a" { 108 | subnet_id = aws_subnet.main-public-2.id 109 | route_table_id = aws_route_table.main-public.id 110 | } 111 | 112 | resource "aws_route_table_association" "main-public-3-a" { 113 | subnet_id = aws_subnet.main-public-3.id 114 | route_table_id = aws_route_table.main-public.id 115 | } 116 | 117 | -------------------------------------------------------------------------------- /4. aws_tf_ec2_s3/iam.tf: -------------------------------------------------------------------------------- 1 | resource "aws_iam_role" "s3-mybucket-role" { 2 | name = "s3-mybucket-role" 3 | assume_role_policy = < 63 | 64 | $inputRoot.body 65 | 66 | EOF 67 | } 68 | } 69 | 70 | 71 | resource "aws_api_gateway_deployment" "example" { 72 | depends_on = [ 73 | aws_api_gateway_integration.Integration 74 | ] 75 | rest_api_id = aws_api_gateway_rest_api.API.id 76 | stage_name = "test" 77 | } -------------------------------------------------------------------------------- /6. aws_tf_api_gateway_lambda_integration/iam-policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": [ 4 | { 5 | "Effect": "Allow", 6 | "Action": [ 7 | "logs:CreateLogGroup", 8 | "logs:CreateLogStream", 9 | "logs:PutLogEvents" 10 | ], 11 | "Resource": "*" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /6. aws_tf_api_gateway_lambda_integration/iam-policy.tf: -------------------------------------------------------------------------------- 1 | resource "aws_iam_role_policy" "iam-policy" { 2 | name = "cloudwatch-policy" 3 | role = aws_iam_role.iam-role.id 4 | policy = file("${path.module}/iam-policy.json") 5 | } -------------------------------------------------------------------------------- /6. aws_tf_api_gateway_lambda_integration/iam-role.tf: -------------------------------------------------------------------------------- 1 | data "aws_iam_policy_document" "assume_role" { 2 | statement { 3 | effect = "Allow" 4 | 5 | principals { 6 | type = "Service" 7 | identifiers = ["lambda.amazonaws.com"] 8 | } 9 | 10 | actions = ["sts:AssumeRole"] 11 | } 12 | } 13 | 14 | resource "aws_iam_role" "iam-role" { 15 | name = "iam-role-lambda-api-gateway" 16 | assume_role_policy = data.aws_iam_policy_document.assume_role.json 17 | } -------------------------------------------------------------------------------- /6. aws_tf_api_gateway_lambda_integration/lambda-function.tf: -------------------------------------------------------------------------------- 1 | resource "aws_lambda_function" "lambda-function" { 2 | filename = "${path.module}/code.zip" 3 | function_name = "api-gw-lambda" 4 | role = aws_iam_role.iam-role.arn 5 | handler = "code.lambda_handler" 6 | runtime = "python3.9" 7 | } -------------------------------------------------------------------------------- /6. aws_tf_api_gateway_lambda_integration/output.tf: -------------------------------------------------------------------------------- 1 | output "api-gateway-url" { 2 | value = aws_api_gateway_deployment.example.invoke_url 3 | } -------------------------------------------------------------------------------- /6. aws_tf_api_gateway_lambda_integration/provider.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-east-1" 3 | } -------------------------------------------------------------------------------- /6. aws_tf_api_gateway_lambda_integration/variables.tf: -------------------------------------------------------------------------------- 1 | variable "AWS_REGION" { 2 | default = "us-east-1" 3 | type = string 4 | sensitive = true 5 | } 6 | 7 | variable "AWS_ACCOUNT_ID" { 8 | default = "Your aws account number" 9 | type = string 10 | sensitive = true 11 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Murali ⚡️ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # terraform-aws-snippets 2 | 3 | You will find list of aws terraform infrastructure templates here in this repo. 4 | 5 | - [1. vpc](./1.%20aws_tf_vpc_basics/) 6 | - [2. rds with secrets manager](./2.%20aws_tf_rds_secrets_manager/) 7 | - [3. ec2 with ebs attachment](./3.%20aws_tf_ec2_ebs_userdata/) 8 | - [4. ec2 with s3 access](./4.%20aws_tf_ec2_s3/) 9 | - [5. ECS with Fargate](./5.%20aws_tf_ecs_fargate/) 10 | - [6. API Gateway + Lambda Integration](./6.%20aws_tf_api_gateway_lambda_integration/) 11 | 12 | ## Contents 13 | 14 | ### 1. VPC 15 | 16 | In this directory you will find terraform code to create AWS VPC and ec2 instances 17 | 18 | ### 2. rds with secrets manager 19 | 20 | In this directory you will find terraform code to create AWS RDS databases using secrets manager. 21 | 22 | ### 3. ec2 with ebs attachment 23 | 24 | In this directory you will find terraform code to create AWS ec2 with ebs attachment on ec2 start up. 25 | 26 | ### 4. ec2 with s3 access 27 | 28 | In this directory you will find terraform code to create AWS ec2 with s3 access using IAM instance profile 29 | 30 | ### 5. ECS using Fargate 31 | 32 | In this directory you will find terraform code to create ECS Cluster using Fargate launch type 33 | 34 | ### 6. API Gateway + Lambda Integration 35 | 36 | In this directory you will find terraform code to create Api gateway + lambda integration 37 | --------------------------------------------------------------------------------