34 lines
1.4 KiB
Markdown
34 lines
1.4 KiB
Markdown
# AWS Terraform 정리
|
|
 
|
|
|
|
## 준비 사항
|
|
- [ ] Terraform 설치 [<spen style="color:yellow">[문서 이동]</spen>](https://developer.hashicorp.com/terraform/install)
|
|
- [ ] AWS CLI 설치 [<spen style="color:yellow">[문서 이동]</spen>](https://docs.aws.amazon.com/ko_kr/cli/latest/userguide/getting-started-install.html)
|
|
- [ ] aws에서 `Access key`와 `Secret access key` 생성
|
|
|
|
## AWS CLI 설정
|
|
```shell
|
|
aws configure # aws configure 생성
|
|
|
|
AWS Access Key ID [None]: # AWS Access Key ID 입력
|
|
AWS Secret Access Key [None]: # Secret Access Key 입력
|
|
Default region name [None]: # 사용할 디폴트 리전 입력
|
|
Default output format [None]: json
|
|
|
|
aws configure get region # 현재 AWS CLI와 연결되어 있는 리전 확인
|
|
```
|
|
> 해당 설정은 필수 사항은 아니며, AWS CLI를 사용할 경우 또는 파일을 통한 참조를 할 때를 위한 작업
|
|
|
|
## tf 파일 작성
|
|
Terraform을 통한 리소스 생성을 위해 tf 파일 작성
|
|
tf 파일 작성 같은 경우 유지보수의 용이를 위하여 종류 별 분리
|
|
|
|
|파일 명|내용|
|
|
|---|---|
|
|
|variables.tf|access key, secret access key, region 등 변수 정의|
|
|
|aws.tf|provider 정의|
|
|
|vpc.tf|vpc, subnet,gateway 등 정의|
|
|
|route.tf|route table 정의|
|
|
|server.tf|EC2 정의|
|
|
|
|
> 추가 예정 |