# AdvancedSecurityOptions

Specifies options for fine-grained access control.

- Source: [`aws-elasticsearch/lib/domain.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-elasticsearch/lib/domain.ts#L439)
- Type last changed: v2.17.0 · 17 Mar 2022

## Example

TypeScript:

```ts
const domain = new es.Domain(this, 'Domain', {
  version: es.ElasticsearchVersion.V7_1,
  enforceHttps: true,
  nodeToNodeEncryption: true,
  encryptionAtRest: {
    enabled: true,
  },
  fineGrainedAccessControl: {
    masterUserName: 'master-user',
  },
});

const masterUserPassword = domain.masterUserPassword;
```

Python:

```python
domain = es.Domain(self, "Domain",
    version=es.ElasticsearchVersion.V7_1,
    enforce_https=True,
    node_to_node_encryption=True,
    encryption_at_rest=es.EncryptionAtRestOptions(
        enabled=True
    ),
    fine_grained_access_control=es.AdvancedSecurityOptions(
        master_user_name="master-user"
    )
)

master_user_password = domain.master_user_password
```

Java:

```java
Domain domain = Domain.Builder.create(this, "Domain")
        .version(ElasticsearchVersion.V7_1)
        .enforceHttps(true)
        .nodeToNodeEncryption(true)
        .encryptionAtRest(EncryptionAtRestOptions.builder()
                .enabled(true)
                .build())
        .fineGrainedAccessControl(AdvancedSecurityOptions.builder()
                .masterUserName("master-user")
                .build())
        .build();

SecretValue masterUserPassword = domain.getMasterUserPassword();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var domain = new Domain(this, "Domain", new DomainProps {
    Version = ElasticsearchVersion.V7_1,
    EnforceHttps = true,
    NodeToNodeEncryption = true,
    EncryptionAtRest = new EncryptionAtRestOptions {
        Enabled = true
    },
    FineGrainedAccessControl = new AdvancedSecurityOptions {
        MasterUserName = "master-user"
    }
});

var masterUserPassword = domain.MasterUserPassword;
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
domain := es.NewDomain(this, jsii.String("Domain"), &DomainProps{
	Version: es.ElasticsearchVersion_V7_1(),
	EnforceHttps: jsii.Boolean(true),
	NodeToNodeEncryption: jsii.Boolean(true),
	EncryptionAtRest: &EncryptionAtRestOptions{
		Enabled: jsii.Boolean(true),
	},
	FineGrainedAccessControl: &AdvancedSecurityOptions{
		MasterUserName: jsii.String("master-user"),
	},
})

masterUserPassword := domain.MasterUserPassword
```

## Properties

- `masterUserArn`: string — use opensearchservice module instead

  **Default:** fine-grained access control is disabled

  Only specify this or masterUserName, but not both.

- `masterUserName`: string — use opensearchservice module instead

  **Default:** fine-grained access control is disabled

  Only specify this or masterUserArn, but not both.

- `masterUserPassword`: [SecretValue](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html) — use opensearchservice module instead

  **Default:** A Secrets Manager generated password

  You can use `SecretValue.unsafePlainText` to specify a password in plain text or
  use `secretsmanager.Secret.fromSecretAttributes` to reference a secret in
  Secrets Manager.
