3.1 Multiaccount VPC 구성

Update: 2020-02-26

MultiAccount를 위한 VPC 구성

이전 랩과 동일하게 git에서 복제한 Cloudformation Stack 중에 "3.multiaccount.yml" 파일을 선택하여 배포합니다. 이 Stack은 "ITOCTANK.yml"과 유사하며 IGW, NATGW, Security Group, VPC, Subnet, Routing Table, SSM구성을 위한 IAM Role생성, EIP 생성, VPC Endpoint 생성 등을 포함하고 있습니다.

1.아래 그림과 같이 Cloudformation 에서 Stack을 생성합니다.

2.[VPC] - [ Subnet] 을 선택하여 정상적으로 자원들이 생성되었는지 확인합니다.

3.EC2 인스턴스에 접속하여 정상동작하는지 확인합니다. Account가 다르므로 , AWS CLI에서 환경을 스위치하여 확인합니다.

export AWS_DEFAULT_PROFILE="Profile name"
# 아래 예제에서 여러개의 프로파일이 생성되어 있는 것을 확인
more ~/.aws/config
[default]
region = us-east-1
output = json
[profile whchoi01]
output = json
region = us-east-1
[profile whchoi02]
output = json
region = us-east-1

4.아래 aws cli를 통해 현재 account에서 동작 중인 EC2 인스턴스를 확인합니다.

aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`] | [0].Value, Placement.AvailabilityZone,InstanceId, InstanceType, ImageId,State.Name, PrivateIpAddress, PublicIpAddress ]' --output table 

-------------------------------------------------------------------------------------------------------------------------------------
|                                                         DescribeInstances                                                         |
+------------------+-------------+----------------------+-----------+------------------------+-------------+---------------+--------+
|  ZOCTANK-Server-A|  us-east-1a |  i-0a5f69553f56db9bc |  t3.small |  ami-0ba97d2d221b828c8 |  running    |  10.5.14.100  |  None  |
|  ZOCTANK-Server-B|  us-east-1b |  i-0700f6d856f7802de |  t3.small |  ami-0ba97d2d221b828c8 |  running    |  10.5.22.100  |  None  |
+------------------+-------------+----------------------+-----------+------------------------+-------------+---------------+--------+

5.EC2 id를 확인 하고, aws ssm 명령어로 접속합니다.

aws ssm start-session --target i-0a5f69553f56db9bc

6.Private Subnet에 연결된 EC2 인스턴스에서 현재 네트워크 연결 구성을 확인합니다. 인터넷을 제외한 어떠한 OCTANK 자원에 연결되지 않습니다. 이것은 OCTANK EC2 인스턴스들이 모두 Private Subnet에 속해 있기 때문입니다.

[ec2-user@ip-10-5-14-100 TGW_CF]$ ./pingshell.sh
Fri Feb 28 16:19:22 UTC 2020
node www.aws.com is up
node ITSVR-A is down
node ITSVR-B is down
node ASVR-A is down
node ASVR-B is down
node BSVR-A is down
node BSVR-B is down
node CSVR-A is down
node CSVR-B is down
node DSVR-A is down
node DSVR-B is down
node FSVR-A is down
node FSVR-B is down
node ZSVR-A is up
node ZSVR-B is up

이제 IT OCTANK VPC와 다른 VPC연결을 위한 구성을 해 보겠습니다.

해당 웹사이트는 크롬, 파이어폭스, 사파리 웹 브라우저에 최적화되어 있습니다. 인터넷 익스플로러에서는 원할하게 보이지 않을 수 있습니다.

Last updated