ν
νλ¦Ώμ μ¬μ©ν 리μμ€ μμ± λ° κ΄λ¦¬
λͺ©μ°¨
κ°μ
β’
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 μ€ν μμ
β’
μΌμΌμ΄ μμμ μλμΌλ‘ μμ ν νμ μμ΄ μ€νμ μμ νλ©΄ μλμΌλ‘ μμ±λ μμμ΄ μμ