|
| 1 | +# Lab - OCP VPC-Shared Installation Steps |
| 2 | + |
| 3 | +> Note: incomplete due to limitations. |
| 4 | +
|
| 5 | +Steps to create VPC-Sharing with Private Hosted Zone (PHZ) on different accounts |
| 6 | + |
| 7 | +Scenario: |
| 8 | +- Account A: |
| 9 | + - VPC sharing with Account_B |
| 10 | +- Account B: |
| 11 | + - private hosted zone |
| 12 | + - EC2 resources running in VPC-Shared by Account_A |
| 13 | + |
| 14 | +## Steps |
| 15 | + |
| 16 | +### Setup Account A |
| 17 | + |
| 18 | +- [Create VPC on Account A](https://us-east-1.console.aws.amazon.com/vpc/home?region=us-east-1#CreateVpcWizard:) |
| 19 | +- [Create a Resource Sharing](https://us-east-1.console.aws.amazon.com/ram/home?region=us-east-1#CreateResourceShare), selecting the subnets to be shared with Account B |
| 20 | + - Tradeoffs when sharing the resources |
| 21 | + - Enabling RAM only in AWS Org will not work |
| 22 | + - Enabling RAM in AWS Org makes the RAM Settings unchangeable |
| 23 | + - Disabling RAM in AWS Org allows the RAM Settings to be changed, then enabled. |
| 24 | + - Once the flag `Enabling sharing with AWS Organizations` is set, you can **create** the resource sharing associated with resources to be shared. |
| 25 | + - It was allowed to enable that flag only in the Master account, where AWS Org is created. The is an open question on how to allow child accounts to use RAM and share resources since the AWS Org RAM flag is not working as expected. |
| 26 | + - Create the resource sharing the subnet. Set the target to Account, Org, or OU, that is placed the Account B |
| 27 | + - Go to Participant account, Account B, and check if the subnets are shared there |
| 28 | + |
| 29 | + |
| 30 | +### Setup Account B |
| 31 | + |
| 32 | +Create the PHZ, associating it to a **LOCAL VPC** (it's not supported to create a PHZ without VPCs, it's also not supported to create a PHZ associating to shared VPC) |
| 33 | + |
| 34 | +- A) Go to `Account A` and run: |
| 35 | + |
| 36 | +> NOTE: Result=Failed - Account A was not authorized to create the requests to PHZ_B. Only when creating the PHZ in Account A |
| 37 | +
|
| 38 | +```bash |
| 39 | +PHZ_ID_B=Z045791747O0ULXC2PQG |
| 40 | +#PHZ_ID_A=Z032052428E32A7FG2XWS |
| 41 | +PHZ_ID=${PHZ_ID_B} |
| 42 | + |
| 43 | +PHZ_REGION=us-east-1 |
| 44 | +VPC_SHARED_REGION=us-east-1 |
| 45 | +VPC_SHARED_ID=vpc-060d341979cb34623 |
| 46 | + |
| 47 | +ACCOUNT_A_AKID="[redacted]" |
| 48 | +ACCOUNT_A_AKSECRET="[redacted]" |
| 49 | +ACCOUNT_A_TOKEN="[redacted]" |
| 50 | + |
| 51 | +AWS_ACCESS_KEY_ID=${ACCOUNT_A_AKID} \ |
| 52 | + AWS_SECRET_ACCESS_KEY=${ACCOUNT_A_AKSECRET} \ |
| 53 | + AWS_SESSION_TOKEN=${ACCOUNT_A_TOKEN} \ |
| 54 | + aws route53 create-vpc-association-authorization \ |
| 55 | + --hosted-zone-id ${PHZ_ID} \ |
| 56 | + --vpc VPCRegion=${VPC_SHARED_REGION},VPCId=${VPC_SHARED_ID} \ |
| 57 | + --region ${PHZ_REGION} |
| 58 | +``` |
| 59 | + |
| 60 | +- B) Return to `Account B` and run: |
| 61 | +```bash |
| 62 | +ACCOUNT_B_AKID="[redacted]" |
| 63 | +ACCOUNT_B_AKSECRET="4[redacted]" |
| 64 | +ACCOUNT_B_TOKEN="[redacted]" |
| 65 | + |
| 66 | + |
| 67 | +AWS_ACCESS_KEY_ID=${ACCOUNT_B_AKID} \ |
| 68 | + AWS_SECRET_ACCESS_KEY=${ACCOUNT_B_AKSECRET} \ |
| 69 | + AWS_SESSION_TOKEN=${ACCOUNT_B_TOKEN} \ |
| 70 | + aws route53 associate-vpc-with-hosted-zone \ |
| 71 | + --hosted-zone-id ${PHZ_ID} \ |
| 72 | + --vpc VPCRegion=${VPC_SHARED_REGION},VPCId=${VPC_SHARED_ID} \ |
| 73 | + --region ${PHZ_REGION} |
| 74 | +``` |
| 75 | +- C) Go back to `Account A` and delete the association request |
| 76 | + |
| 77 | +```bash |
| 78 | +AWS_ACCESS_KEY_ID=${ACCOUNT_A_AKID} \ |
| 79 | + AWS_SECRET_ACCESS_KEY=${ACCOUNT_A_AKSECRET} \ |
| 80 | + AWS_SESSION_TOKEN=${ACCOUNT_A_TOKEN} \ |
| 81 | + aws route53 delete-vpc-association-authorization \ |
| 82 | + --hosted-zone-id ${PHZ_ID} \ |
| 83 | + --vpc VPCRegion=${VPC_SHARED_REGION},VPCId=${VPC_SHARED_ID} \ |
| 84 | + --region ${PHZ_REGION} |
| 85 | +``` |
| 86 | + |
| 87 | +### Create resources on Shared-VPC |
| 88 | + |
| 89 | +- Return to `Account B` and run instances in the shared VPC |
0 commit comments