The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import * as AWS from "@alchemy.run/aws"; |
| 2 | import type { Output } from "alchemy/Output"; |
| 3 | import * as Context from "effect/Context"; |
| 4 | import * as Effect from "effect/Effect"; |
| 5 | import * as Layer from "effect/Layer"; |
| 6 | |
| 7 | export interface ExampleNetwork { |
| 8 | network: AWS.EC2.Network; |
| 9 | publicSubnetIds: Output<AWS.EC2.SubnetId>[]; |
| 10 | appSecurityGroupId: Output<AWS.EC2.SecurityGroupId>; |
| 11 | } |
| 12 | |
| 13 | export class Network extends Context.Service<Network, ExampleNetwork>()("Network") {} |
| 14 | |
| 15 | export const NetworkLive = Layer.effect( |
| 16 | Network, |
| 17 | Effect.gen(function* () { |
| 18 | const network = yield* AWS.EC2.Network("Network", { |
| 19 | cidrBlock: "10.42.0.0/16", |
| 20 | availabilityZones: 2, |
| 21 | nat: "single", |
| 22 | }); |
| 23 | |
| 24 | const appSecurityGroup = yield* AWS.EC2.SecurityGroup("AppSecurityGroup", { |
| 25 | vpcId: network.vpcId, |
| 26 | description: "Security group for the EC2 application instance", |
| 27 | ingress: [ |
| 28 | { |
| 29 | ipProtocol: "tcp", |
| 30 | fromPort: 3000, |
| 31 | toPort: 3000, |
| 32 | cidrIpv4: "0.0.0.0/0", |
| 33 | }, |
| 34 | ], |
| 35 | }); |
| 36 | |
| 37 | return { |
| 38 | network, |
| 39 | publicSubnetIds: network.publicSubnetIds, |
| 40 | appSecurityGroupId: appSecurityGroup.groupId, |
| 41 | }; |
| 42 | }), |
| 43 | ); |