aws-cdk-lib.aws_efs.PosixUser

interface PosixUser

LanguageType name
.NETAmazon.CDK.AWS.EFS.PosixUser
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsefs#PosixUser
Javasoftware.amazon.awscdk.services.efs.PosixUser
Pythonaws_cdk.aws_efs.PosixUser
TypeScript (source)aws-cdk-lib » aws_efs » PosixUser

Represents the PosixUser.

Example

import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as efs from 'aws-cdk-lib/aws-efs';

// create a new VPC
const vpc = new ec2.Vpc(this, 'VPC');

// create a new Amazon EFS filesystem
const fileSystem = new efs.FileSystem(this, 'Efs', { vpc });

// create a new access point from the filesystem
const accessPoint = fileSystem.addAccessPoint('AccessPoint', {
  // set /export/lambda as the root of the access point
  path: '/export/lambda',
  // as /export/lambda does not exist in a new efs filesystem, the efs will create the directory with the following createAcl
  createAcl: {
    ownerUid: '1001',
    ownerGid: '1001',
    permissions: '750',
  },
  // enforce the POSIX identity so lambda function will access with this identity
  posixUser: {
    uid: '1001',
    gid: '1001',
  },
});

const fn = new lambda.Function(this, 'MyLambda', {
  // mount the access point to /mnt/msg in the lambda runtime environment
  filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'),
  runtime: lambda.Runtime.NODEJS_18_X,
  handler: 'index.handler',
  code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
  vpc,
});

Properties

NameTypeDescription
gidstringThe POSIX group ID used for all file system operations using this access point.
uidstringThe POSIX user ID used for all file system operations using this access point.
secondaryGids?string[]Secondary POSIX group IDs used for all file system operations using this access point.

gid

Type: string

The POSIX group ID used for all file system operations using this access point.


uid

Type: string

The POSIX user ID used for all file system operations using this access point.


secondaryGids?

Type: string[] (optional, default: None)

Secondary POSIX group IDs used for all file system operations using this access point.