# InstanceEndpoint

Use an EC2 Instance as a Global Accelerator Endpoint.

Implements: [IEndpoint](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_globalaccelerator.IEndpoint.html)

- Source: [`aws-globalaccelerator-endpoints/lib/instance.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-globalaccelerator-endpoints/lib/instance.ts#L35)

## Example

TypeScript:

```ts
declare const listener: globalaccelerator.Listener;
declare const instance: ec2.Instance;

listener.addEndpointGroup('Group', {
  endpoints: [
    new ga_endpoints.InstanceEndpoint(instance, {
      weight: 128,
      preserveClientIp: true,
    }),
  ],
});
```

Python:

```python
# listener: globalaccelerator.Listener
# instance: ec2.Instance

listener.add_endpoint_group("Group",
    endpoints=[
        ga_endpoints.InstanceEndpoint(instance,
            weight=128,
            preserve_client_ip=True
        )
    ]
)
```

Java:

```java
Listener listener;
Instance instance;

listener.addEndpointGroup("Group", EndpointGroupOptions.builder()
        .endpoints(List.of(
            InstanceEndpoint.Builder.create(instance)
                    .weight(128)
                    .preserveClientIp(true)
                    .build()))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Listener listener;
Instance instance;

listener.AddEndpointGroup("Group", new EndpointGroupOptions {
    Endpoints = new [] {
        new InstanceEndpoint(instance, new InstanceEndpointProps {
            Weight = 128,
            PreserveClientIp = true
        }) }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var listener Listener
var instance Instance

listener.AddEndpointGroup(jsii.String("Group"), &EndpointGroupOptions{
	Endpoints: []IEndpoint{
		ga_endpoints.NewInstanceEndpoint(instance, &InstanceEndpointProps{
			Weight: jsii.Number(128),
			PreserveClientIp: jsii.Boolean(true),
		}),
	},
})
```

## Initializer

TypeScript:

```ts
new InstanceEndpoint(instance: IInstance, options?: InstanceEndpointProps)
```

Python:

```python
InstanceEndpoint(instance: IInstance, options: typing.Optional[InstanceEndpointProps] = None)
```

Java:

```java
new InstanceEndpoint(IInstance instance, InstanceEndpointProps options)
```

C# / .NET:

```csharp
new InstanceEndpoint(IInstance instance, InstanceEndpointProps? options = null)
```

Golang:

```go
NewInstanceEndpoint(Instance IInstance, Options InstanceEndpointProps)
```

## Properties

- `region`: string — The region where the endpoint is located.

  If the region cannot be determined, `undefined` is returned

## Methods

- `renderEndpointConfiguration(): any` — Render the endpoint to an endpoint configuration.
