본문 바로가기

728x90

AWS

[Ansible] ansible 인벤토리 설정 파일 ansible 인벤토리 설정 파일 인벤토리 설정 기본적으로 /etc/ansible/hosts 파일 사용한다 > vim /etc/ansible/hosts [aweb21] asweb21 ansible_host=10.21.3.54 ansible_connection=ssh ansible_por=22 ansible_user=ec2-user ansible_ssh_private_key_file=~/aws-key/keyfile.pem asweb22 ansible_host=10.21.4.199 ansible_connection=ssh ansible_por=22 ansible_user=ec2-user ansible_ssh_private_key_file=~/aws-key/keyfile.pem 인벤토리에 등록된 호스트로 핑 .. 더보기
[Terraform] 테라폼 리소스 태그 지정(tags) -2 테라폼 리소스 태그 지정(tags) key_pair 편집 - key_pair 모듈 $ vim key_pair.tf ###keypair 생성 resource "aws_key_pair" "this" { count = var.create ? 1 : 0 key_name = var.key_name public_key = var.public_key lifecycle { ignore_changes = [ tags.CreatedDate ] } tags = merge( var.customer_tags, { Name = "${var.suffix}-rds01" } ) } vars.tf 편집 - key_pair 모듈 변수 $ vim vars.tf variable "customer_tags" {} main.tf 편집 - 메인 .. 더보기
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 계정과 리소스 간의 협업을 가능.. 더보기
[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] 테라폼 키 페어 생성 키 페어 생성 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 = "terraform@email.com" 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 = "terraform@email.com" Owner = "iac" Role = "security_group" Service = "security" } ingress { description = ".. 더보기
[Terraform] 테라폼 ALB(로드밸런서) 생성 ALB(로드밸런서) 생성 (선행 작업) - Route 53 생성 - SSL 인증서 생성 - security group 생성 - 인스턴스 생성 - ./script/install_web1.sh 스크립트 생성 alb.tf 파일 생성 $ vim alb.tf ####################ALB 생성 resource "aws_alb" "tf_alb-web1" { name = "web1" internal = false load_balancer_type = "application" idle_timeout = 60 security_groups = [ aws_security_group.tf_vpc99_sg_alb-web1.id ] subnets = [ aws_subnet.tf_vpc99-sb11.id, aws_su.. 더보기
[Terraform] 테라폼 ec2 인스턴스 생성 ec2 인스턴스 생성 (선행 작업) - key pair 생성 - security group 생성 - ./script/install_web1.sh 스크립트 생성 instance.tf 파일 생성 $ vim instance.tf resource "aws_instance" "web31" { ami = "ami-047a51fa27710816e" instance_type = "t2.micro" #ebs_optimized = true #monitoring = true #count = 1 key_name = aws_key_pair.aws_key_4wxyz.key_name associate_public_ip_address = true # subnet_id = aws_subnet.sangchul_vpc11-sb3.id v.. 더보기

반응형