블둝체인
블둝체인

CloudFormation

ν…œν”Œλ¦Ώμ„ μ‚¬μš©ν•œ λ¦¬μ†ŒμŠ€ 생성 및 관리
λͺ©μ°¨

κ°œμš”

β€’
AWS의 μ½”λ“œλ‘œμ„œμ˜ 인프라
β€’
같은 역할을 ν•˜λŠ” μ˜€ν”ˆμ†ŒμŠ€λ‘œλŠ” Terraform이 있음
β€’
ν”„λ‘œκ·Έλž˜λ° μ–Έμ–΄λ‚˜ ν…μŠ€νŠΈ νŒŒμΌμ„ μ΄μš©ν•˜μ—¬ AWS λ¦¬μ†ŒμŠ€λ₯Ό μžλ™μœΌλ‘œ 배포
β€’
AWS λ¦¬μ†ŒμŠ€λ₯Ό 반볡적으둜 μƒμ„±ν•˜κ³  λ°°ν¬ν•˜λŠ” μž‘μ—…μ„ μΌκ΄€λœ λ°©μ‹μœΌλ‘œ μžλ™ν™”ν•˜κ³  κ°„μ†Œν™”
β€’
μƒˆ ν™˜κ²½κ³Ό ν•¨κ»˜ λͺ¨λ“  λ³΄μ•ˆ 및 κ·œμ • μ€€μˆ˜ μ œμ–΄ ν•­λͺ©μ„ 배포 κ°€λŠ₯
β€’
AWS 인프라λ₯Ό ν”„λ‘œλΉ„μ €λ‹ν•˜λŠ” λΉ„μš©κ³Ό μ‹œκ°„μ„ μ ˆμ•½ ν•  수 있음
1. ν…œν”Œλ¦Ώ
β€’
생성할 AWS 인프라 μžμ›(EC2, λ³΄μ•ˆκ·Έλ£Ή , IP, S3, ELB… 인프라 κ΄€λ ¨ μ„€μ •)을 μ •μ˜ν•œ 파일
β€’
JSONμ΄λ‚˜ YAMLν˜•μ‹μ˜ μ½”λ“œλ‘œ μž‘μ„± κ°€λŠ₯
2. μŠ€νƒ 생성
β€’
ν…œν”Œλ¦Ώμ„ CloudFormation에 μ—…λ‘œλ“œν•˜μ—¬ μŠ€νƒ 생성
β€’
μŠ€νƒμ„ μƒμ„±ν•˜λ©΄ ν…œν”Œλ¦Ώμ— μ •μ˜λœ AWS 인프라 μžμ›μ— λŒ€ν•΄ μˆœμ„œλŒ€λ‘œ μžλ™ 생성
3. μŠ€νƒ μ‚­μ œ
β€’
μŠ€νƒμ„ μ‚­μ œν•˜λ©΄ μŠ€νƒ 생성에 μ˜ν•΄ μƒμ„±λœ AWS 인프라 μžμ›μ„ μˆœμ„œλŒ€λ‘œ μžλ™ μ‚­μ œ

μ‹€μŠ΅

β€’
μ •μ˜λœ ν…œν”Œλ¦Ώμ— λŒ€ν•΄ CloudFormation μŠ€νƒμ„ μƒμ„±ν•˜μ—¬ 인프라λ₯Ό μžλ™μœΌλ‘œ μƒμ„±ν•˜κ³ , CloudFormation μŠ€νƒμ„ μ‚­μ œν•˜μ—¬ μƒμ„±λœ 인프라λ₯Ό μžλ™μœΌλ‘œ μ‚­μ œ
1. CloudFormation ν…œν”Œλ¦Ώ
β€’
λ‹€μš΄λ‘œλ“œ 링크 : http://bit.ly/cnbl0102
Parameters: KeyName: Description: Name of an existing EC2 KeyPair to enable SSH access to the instances. Linked to AWS Parameter Type: AWS::EC2::KeyPair::KeyName ConstraintDescription: must be the name of an existing EC2 KeyPair. LatestAmiId: Description: (DO NOT CHANGE) Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>' Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2' AllowedValues: - /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 Resources: MyInstance: Type: AWS::EC2::Instance Properties: ImageId: !Ref LatestAmiId InstanceType: t2.micro KeyName: !Ref KeyName Tags: - Key: Name Value: WebServer SecurityGroups: - !Ref MySG UserData: Fn::Base64: !Sub | #!/bin/bash yum install httpd -y systemctl start httpd && systemctl enable httpd echo "<h1>Test Web Server</h1>" > /var/www/html/index.html MySG: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: Enable HTTP access via port 80 and SSH access via port 22 SecurityGroupIngress: - IpProtocol: tcp FromPort: 80 ToPort: 80 CidrIp: 0.0.0.0/0 - IpProtocol: tcp FromPort: 22 ToPort: 22 CidrIp: 0.0.0.0/0
YAML
볡사
2. CloudFormation μŠ€νƒ 생성
3. CloudFormation μŠ€νƒ μ‚­μ œ
β€’
일일이 μžμ›μ„ μˆ˜λ™μœΌλ‘œ μ‚­μ œν•  ν•„μš” 없이 μŠ€νƒμ„ μ‚­μ œν•˜λ©΄ μžλ™μœΌλ‘œ μƒμ„±λœ μžμ›μ΄ μ‚­μ œ