Experimental
@aws-cdk/aws-gamelift-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
Peer Class
Peer object factories.
The static methods on this object can be used to create peer objects which represent a connection partner in inbound permission rules.
Use this object if you need to represent connection partners using plain IP addresses.
Example
ts
declare const build: gamelift.Build;
const fleet = new gamelift.BuildFleet(this, 'Game server fleet', {
fleetName: 'test-fleet',
content: build,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
runtimeConfiguration: {
serverProcesses: [{
launchPath: '/local/game/GameLiftExampleServer.x86_64',
}]
},
ingressRules: [{
source: gamelift.Peer.anyIpv4(),
port: gamelift.Port.tcpRange(100, 200),
}]
});
// Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.addIngressRule(gamelift.Peer.ipv4('1.2.3.4/32'), gamelift.Port.udp(1111));
python
# build: gamelift.Build
fleet = gamelift.BuildFleet(self, "Game server fleet",
fleet_name="test-fleet",
content=build,
instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
runtime_configuration=gamelift.RuntimeConfiguration(
server_processes=[gamelift.ServerProcess(
launch_path="/local/game/GameLiftExampleServer.x86_64"
)]
),
ingress_rules=[gamelift.IngressRule(
source=gamelift.Peer.any_ipv4(),
port=gamelift.Port.tcp_range(100, 200)
)]
)
# Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.add_ingress_rule(gamelift.Peer.ipv4("1.2.3.4/32"), gamelift.Port.udp(1111))
java
Build build;
BuildFleet fleet = BuildFleet.Builder.create(this, "Game server fleet")
.fleetName("test-fleet")
.content(build)
.instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
.runtimeConfiguration(RuntimeConfiguration.builder()
.serverProcesses(List.of(ServerProcess.builder()
.launchPath("/local/game/GameLiftExampleServer.x86_64")
.build()))
.build())
.ingressRules(List.of(IngressRule.builder()
.source(Peer.anyIpv4())
.port(Port.tcpRange(100, 200))
.build()))
.build();
// Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.addIngressRule(Peer.ipv4("1.2.3.4/32"), Port.udp(1111));
csharp
// Install: dotnet add package Amazon.CDK.AWS.GameLift.Alpha
Build build;
var fleet = new BuildFleet(this, "Game server fleet", new BuildFleetProps {
FleetName = "test-fleet",
Content = build,
InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE),
RuntimeConfiguration = new RuntimeConfiguration {
ServerProcesses = new [] { new ServerProcess {
LaunchPath = "/local/game/GameLiftExampleServer.x86_64"
} }
},
IngressRules = new [] { new IngressRule {
Source = Peer.AnyIpv4(),
Port = Port.TcpRange(100, 200)
} }
});
// Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.AddIngressRule(Peer.Ipv4("1.2.3.4/32"), Port.Udp(1111));
go
// Install: go get github.com/aws/aws-cdk-go/awscdkgameliftalpha/v2
var build Build
fleet := gamelift.NewBuildFleet(this, jsii.String("Game server fleet"), &BuildFleetProps{
FleetName: jsii.String("test-fleet"),
Content: build,
InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
RuntimeConfiguration: &RuntimeConfiguration{
ServerProcesses: []ServerProcess{
&ServerProcess{
LaunchPath: jsii.String("/local/game/GameLiftExampleServer.x86_64"),
},
},
},
IngressRules: []IngressRule{
&IngressRule{
Source: gamelift.Peer_AnyIpv4(),
Port: gamelift.Port_TcpRange(jsii.Number(100), jsii.Number(200)),
},
},
})
// Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.AddIngressRule(gamelift.Peer_Ipv4(jsii.String("1.2.3.4/32")), gamelift.Port_Udp(jsii.Number(1111)))
Initializer
ts
new Peer()
python
Peer()
java
new Peer()
csharp
new Peer()
go
NewPeer()