MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / defaultSubnet

Function defaultSubnet

e2e/src/vm/ec2.ts:121–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119};
120
121const defaultSubnet = async (): Promise<string> => {
122 const vpc = await aws([
123 "ec2",
124 "describe-vpcs",
125 "--filters",
126 "Name=isDefault,Values=true",
127 "--query",
128 "Vpcs[0].VpcId",
129 ]);
130 const subnet = await aws([
131 "ec2",
132 "describe-subnets",
133 "--filters",
134 `Name=vpc-id,Values=${vpc}`,
135 "Name=default-for-az,Values=true",
136 "--query",
137 "Subnets[0].SubnetId",
138 ]);
139 return subnet && subnet !== "None"
140 ? subnet
141 : aws([
142 "ec2",
143 "describe-subnets",
144 "--filters",
145 `Name=vpc-id,Values=${vpc}`,
146 "--query",
147 "Subnets[0].SubnetId",
148 ]);
149};
150
151/** Create (idempotently) a security group allowing inbound SSH from this host. */
152const ensureSecurityGroup = async (myIp: string): Promise<string> => {

Callers 1

ec2VmFunction · 0.85

Calls 1

awsFunction · 0.85

Tested by

no test coverage detected