{VPC}共有 VPC の操作

https://docs.aws.amazon.com/ja_jp/vpc/latest/userguide/vpc-sharing.html
https://dev.classmethod.jp/articles/reinvent-2018-ram-vpc-share/

AWS Organizations サブネットが共有されると、参加者は共有しているサブネット内にある自分のアプリケーションリソースを
表示、作成、変更、および削除できます。
参加者は、他の参加者または VPC 所有者に属するリソースを表示、変更、または削除することはできません。

Owners cannot share subnets that are in a default VPC.


-- 1. コマンド等のインストール

-- 1.1 aws cli version 2 インストール

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aws --version

 

-- 2. リソース共有の作成

aws ram list-resources --resource-owner SELF


aws ram create-resource-share \
--name rs01 \
--resource-arns arn:aws:ec2:ap-northeast-1:999999999999:subnet/subnet-11111111111111111 \
--principals arn:aws:organizations::999999999999:organization/o-1111111111 \
--no-allow-external-principals

 

-- 3. リソース共有の解除

aws ram list-resources --resource-owner SELF

aws ram delete-resource-share \
--resource-share-arn arn:aws:ram:ap-northeast-1:999999999999:resource-share/11111111-2222-3333-4444-555555555555