Skip to content
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

테라폼을 활용한 ElastiCache 프로비저닝 #14

Merged
merged 5 commits into from Dec 8, 2022

Conversation

ku-kim
Copy link
Owner

@ku-kim ku-kim commented Dec 8, 2022

❗️ 이슈 번호

#13



📝 구현 내용

이 PR은 테라폼을 활용하여 ElastiCache를 프로비저닝 하는 예 입니다. (iam, vpc, subnet, security group, elasticache)
ElastiCache는 기본적으로 private subnet으로 외부 통신이 통제되며 같은 vpc ec2에서만 접근가능합니다.
ec2는 프로비저닝하지 않습니다.

ElastiCache 프로비저닝 (iam, VPC, subnet, security group, elasticache)

# infra/elasticache 디렉토리에 있다는 가정하에
terraform init 

terraform plan

terraform apply

image

ec2에서 연결 확인

  • 전제 조건 : 사용할 ec2는 사전에 Elasticache와 같은 vpc에 있고 이미 만들어져있다고 가정합니다.

image

자원 제거

# infra/elasticache 디렉토리에 있다는 가정하에
terraform destroy

image



💡 참고 자료

Comment on lines +24 to +37
resource "aws_elasticache_cluster" "redis-terraform-test" {
cluster_id = "redis-terraform-test"
engine = "redis"
node_type = "cache.t2.micro"
num_cache_nodes = 1 # node 1개
parameter_group_name = "default.redis7" # 파라미터 그룹
engine_version = "7.0" # 레디스 버전
port = 6379
security_group_ids = [
aws_security_group.infra_test_redis_security_group.id
]

subnet_group_name = aws_elasticache_subnet_group.infra_test_vpc_subnet_group.name
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redis는 단일 노드로 생성하였고 프리티어 대상 t2.micro로 생성하였습니다.

Comment on lines +2 to +10
resource "aws_iam_user" "infra-users" {
count = length(var.users)
name = element(var.users, count.index)
path = "/infra/"

tags = {
Name = "infra-developers"
}
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iam 생성은 필수가 아니지만 학습 목적으로 만들었습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform을 활용한 ElastiCache 프로비저닝과 ec2 연결
1 participant