본문 바로가기

반응형

퍼블릭 클라우드

[Terraform] 테라폼 concat 함수(function) 테라폼 concat 함수(function) : concat은 둘 이상의 목록을 가져와서 단일 목록으로 결합합니다. instance 모듈 instance.tf 편집 resource "aws_instance" "instance" { count = var.instance_count instance_type = var.instance_type ami = lookup(var.aws_amis, var.aws_region) key_name = var.key_name subnet_id = element(var.subnet_id, count.index) vpc_security_group_ids = var.vpc_security_group_ids associate_public_ip_address = var.associat.. 더보기
[VPN] Amazon Linux 2에 WireGuard를 설치하는 방법 Amazon Linux 2에 WireGuard를 설치하는 방법 ### epel 리포지토리 설치 $ amazon-linux-extras install epel ### wireguard 리포지토리 설치 $ curl -sL https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo -o /etc/yum.repos.d/wireguard.repo ### wireguard 패키지 설치 $ yum install wireguard-dkms wireguard-tools 더보기
AWS 교차 계정 접근(Cross-Account Access)을 설정하는 방법 AWS 교차 계정 접근(Cross-Account Access)을 설정하는 방법 1. 새로운 역할(role) 구성 AWS 관리 콘솔 > IAM > 역할 > 역할만들기 정책: AdministratorAccess 역할 이름: SwitchRole 역할 설명: Switch Role 2. 정책 생성 AWS 관리 콘솔 > IAM > 정책> 정책 생성 정책: STS:AssumeRole 이름: STSPolicy 설명: STS Policy 3. 사용자에 정책 할당 AWS 관리 콘솔 > IAM > 사용자 > user > 요약 > 권한 추가 4. 사용자(user) 재로그인 후 역할 전환 5. 역할 전환 확인 AWS 교차 계정 접근을 설정하면 보안 및 권한 관리를 효과적으로 제어하고 다른 AWS 계정과 리소스 간의 협업을 가능.. 더보기
[Terraform] 테라폼 모듈화 테스트 테라폼(terraform) 모듈화 테스트 루트 모듈에서 VPC 구성 main.tf 파일 $ vim main.tf module "vpc" { source = "../../../tfmodules/vpc/" aws_region = "ap-northeast-2" suffix = "11" tf_env = "test" #tf_domain = "test.tf.4wxyz.com" public-cidr = ["10.11.12.0/23", "10.11.16.0/23"] private-cidr = ["10.11.22.0/24", "10.11.26.0/24"] mgmt-cidr = ["10.11.92.0/24", "10.11.96.0/24"] azs = ["ap-northeast-2a", "ap-northeast-2c"] }.. 더보기
[ping] Pingcloud-cli 툴 Pingcloud-cli 툴 $ git clone https://github.com/reoim/pingcloud-cli.git $ cd pingcloud-cli $ pingcloud-cli aws $ pingcloud-cli aws us-east-1 https://github.com/reoim/pingcloud-cli.git reoim/pingcloud-cli CLI application to check http request latency of AWS, Google Cloud Platform and Azure - reoim/pingcloud-cli github.com 웹 브라우저에서 통한 latency 체크 https://www.cloudping.co/grid https://github.com/mda5.. 더보기
[Terraform] 테라폼 모듈화 테스트 테라폼 모듈화 테스트 디렉토리 구조 . ├── main.tf ├── modules │ ├── EC2 │ │ ├── main.tf │ │ └── script │ │ └── install_web1.sh │ ├── RDS │ └── VPC ├── provider.tf └── variables.tf 루트 모듈 provider.tf $ vim provider.tf ### ./provider.tf terraform { required_providers { aws = { source = "hashicorp/aws" version = "3.25.0" } } } provider "aws" { # Configuration options shared_credentials_file = "~/.aws/credentials" r.. 더보기
[Terraform] 테라폼 키 페어 생성 키 페어 생성 key.tf 파일 생성 $ vim key.tf ###keypair 생성 resource "aws_key_pair" "tf_key_4wxyz" { key_name = "4wxyz" public_key = file("~/aws-key-pair/4wxyz.pub") tags = { Name = "4wxyz" Env = "stg" CreateUser = "[email protected]" Owner = "iac" Role = "keypair" Service = "keypair" } } 더보기
[Terraform] 테라폼 보안 그룹에 정책 추가 보안 그룹에 정책 추가 - EC2 보안 그룹에 ALB 정책 추가 ec2-sg.tf $ vim ec2-sg.tf ####################EC2 웹 시큐리티 구룹 생성 resource "aws_security_group" "tf_vpc99_sg-ec2-web1" { name = "ec2-web1" description = "Managed In Terraform" vpc_id = aws_vpc.tf_vpc99.id tags = { Name = "ec2-web1" Env = "stg" CreateUser = "[email protected]" Owner = "iac" Role = "security_group" Service = "security" } ingress { description = ".. 더보기

728x90
반응형