# RedisResource.WithHostPort

- Module: [Aspire.Hosting.Redis](/reference/api/go/aspire.hosting.redis.md)
- Defined on: [RedisResource](/reference/api/go/aspire.hosting.redis/redisresource.md)
- Version: `17.0.0`
- Kind: `method`

Configures the host port that the Redis resource is exposed on instead of using randomly assigned port.

## Definition

```go
type RedisResource interface {
    // ... omitted for brevity
    WithHostPort(port *float64) RedisResource
}
```

## Signature

```go
WithHostPort(port *float64) RedisResource
```

## Parameters

- `port` (`*float64`) -- The port to bind on the host. If `null` is used random port will be assigned.

## Returns

[`RedisResource`](/reference/api/go/aspire.hosting.redis/redisresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [RedisResource](/reference/api/go/aspire.hosting.redis/redisresource.md) -- `handle`
