This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Nginx 설치 | |
apt update | |
apt install -y nginx | |
index_file="/var/www/html/index.html" | |
cat <<EOF > $index_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure the AWS Provider | |
provider "aws" { | |
region = "ap-northeast-2" | |
} | |
# resource - instanace | |
resource "aws_instance" "mymymi_ubuntu" { | |
ami = data.aws_ami.ubuntu.id | |
instance_type = "t2.micro" | |
tags = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
region = "ap-northeast-2" | |
} | |
resource "aws_instance" "example" { | |
ami = "ami-050a4617492ff5822" | |
instance_type = "t2.micro" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Action": [ | |
"s3:PutObject", | |
"s3:GetObject", | |
"s3:DeleteObject" | |
], | |
"Resource": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:List*", | |
"Resource": "arn:aws:s3:::*" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowCloudFrontServicePrincipalReadOnly", | |
"Effect": "Allow", | |
"Principal": { | |
#cloudFront를 대상으로 아래의 action을 허용 | |
"Service": "cloudfront.amazonaws.com" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Outputs: # 결과로 제공할 데이터를 | |
VPC: | |
Description: VPC | |
Value: !Ref VPC | |
AZ1: | |
Description: Availability Zone 1 | |
Value: !GetAtt | |
- PublicSubnet | |
- AvailabilityZone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Deploy VPC | |
Resources: | |
PublicSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
VpcId: !Ref VPC #VPC의 ID를 참조 | |
CidrBlock: 10.0.0.0/24 #VPC 네트워크 내의 CIDR 주소를 선택 | |
AvailabilityZone: !Select #!Select는 함수로, 리전 내의 가용 영역을 검색 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Deploy VPC | |
Resources: | |
InternetGateway: | |
Type: AWS::EC2::InternetGateway | |
Properties: | |
Tags: | |
- Key: Name | |
Value: Internet Gateway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Deploy VPC | |
Resources: | |
VPC: | |
Type: AWS::EC2::VPC | |
Properties: | |
CidrBlock: 10.0.0.0/16 # CIDR 범위를 하드 코딩, 입력 값으로 받을 수도 있다. | |
EnableDnsHostnames: true # DNS를 할당하도록 활성화 | |
Tags: #태깅 작업 | |
- Key: Name |
NewerOlder