cdk-efs-assets-0.3.95
0.3.95
0.3.94
0.3.93
0.3.92
0.3.91
0.3.90
0.3.9
0.3.89
0.3.88
0.3.87
0.3.86
0.3.85
0.3.84
0.3.83
0.3.82
0.3.81
0.3.80
0.3.8
0.3.79
0.3.78
0.3.77
0.3.76
0.3.75
0.3.74
0.3.73
0.3.72
0.3.71
0.3.70
0.3.7
0.3.69
0.3.68
0.3.67
0.3.66
0.3.65
0.3.64
0.3.63
0.3.62
0.3.61
0.3.60
0.3.6
0.3.59
0.3.58
0.3.57
0.3.56
0.3.55
0.3.54
0.3.53
0.3.52
0.3.51
0.3.50
0.3.5
0.3.49
0.3.48
0.3.47
0.3.46
0.3.45
0.3.44
0.3.43
0.3.42
0.3.41
0.3.40
0.3.4
0.3.39
0.3.38
0.3.37
0.3.36
0.3.35
0.3.34
0.3.33
0.3.32
0.3.31
0.3.30
0.3.3
0.3.29
0.3.28
0.3.27
0.3.26
0.3.25
0.3.24
0.3.23
0.3.22
0.3.21
0.3.20
0.3.2
0.3.19
0.3.18
0.3.17
0.3.16
0.3.15
0.3.14
0.3.13
0.3.12
0.3.11
0.3.10
0.3.1
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.37
0.2.36
0.2.35
0.2.34
0.2.33
0.2.32
0.2.31
0.2.30
0.2.3
0.2.29
0.2.28
0.2.27
0.2.26
0.2.25
0.2.24
0.2.23
0.2.22
0.2.21
0.2.20
0.2.2
0.2.19
0.2.18
0.2.17
0.2.16
0.2.15
0.2.14
0.2.13
0.2.12
0.2.11
0.2.10
0.2.1
0.1.9
0.1.8
0.1.75
0.1.74
0.1.73
0.1.72
0.1.71
0.1.70
0.1.7
0.1.69
0.1.68
0.1.67
0.1.66
0.1.65
0.1.64
0.1.63
0.1.62
0.1.61
0.1.60
0.1.6
0.1.59
0.1.58
0.1.57
0.1.56
0.1.55
0.1.54
0.1.53
0.1.52
0.1.51
0.1.50
0.1.5
0.1.49
0.1.48
0.1.47
0.1.46
0.1.45
0.1.44
0.1.43
0.1.42
0.1.41
0.1.40
0.1.39
0.1.38
0.1.37
0.1.36
0.1.35
0.1.34
0.1.33
0.1.32
0.1.31
0.1.30
0.1.29
0.1.28
0.1.27
0.1.26
0.1.25
0.1.24
0.1.23
0.1.22
0.1.21
0.1.20
0.1.2
0.1.19
0.1.18
0.1.17
0.1.16
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.0.2
0.3.95
0.3.94
0.3.93
0.3.92
0.3.91
0.3.90
0.3.9
0.3.89
0.3.88
0.3.87
0.3.86
0.3.85
0.3.84
0.3.83
0.3.82
0.3.81
0.3.80
0.3.8
0.3.79
0.3.78
0.3.77
0.3.76
0.3.75
0.3.74
0.3.73
0.3.72
0.3.71
0.3.70
0.3.7
0.3.69
0.3.68
0.3.67
0.3.66
0.3.65
0.3.64
0.3.63
0.3.62
0.3.61
0.3.60
0.3.6
0.3.59
0.3.58
0.3.57
0.3.56
0.3.55
0.3.54
0.3.53
0.3.52
0.3.51
0.3.50
0.3.5
0.3.49
0.3.48
0.3.47
0.3.46
0.3.45
0.3.44
0.3.43
0.3.42
0.3.41
0.3.40
0.3.4
0.3.39
0.3.38
0.3.37
0.3.36
0.3.35
0.3.34
0.3.33
0.3.32
0.3.31
0.3.30
0.3.3
0.3.29
0.3.28
0.3.27
0.3.26
0.3.25
0.3.24
0.3.23
0.3.22
0.3.21
0.3.20
0.3.2
0.3.19
0.3.18
0.3.17
0.3.16
0.3.15
0.3.14
0.3.13
0.3.12
0.3.11
0.3.10
0.3.1
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.37
0.2.36
0.2.35
0.2.34
0.2.33
0.2.32
0.2.31
0.2.30
0.2.3
0.2.29
0.2.28
0.2.27
0.2.26
0.2.25
0.2.24
0.2.23
0.2.22
0.2.21
0.2.20
0.2.2
0.2.19
0.2.18
0.2.17
0.2.16
0.2.15
0.2.14
0.2.13
0.2.12
0.2.11
0.2.10
0.2.1
0.1.9
0.1.8
0.1.75
0.1.74
0.1.73
0.1.72
0.1.71
0.1.70
0.1.7
0.1.69
0.1.68
0.1.67
0.1.66
0.1.65
0.1.64
0.1.63
0.1.62
0.1.61
0.1.60
0.1.6
0.1.59
0.1.58
0.1.57
0.1.56
0.1.55
0.1.54
0.1.53
0.1.52
0.1.51
0.1.50
0.1.5
0.1.49
0.1.48
0.1.47
0.1.46
0.1.45
0.1.44
0.1.43
0.1.42
0.1.41
0.1.40
0.1.39
0.1.38
0.1.37
0.1.36
0.1.35
0.1.34
0.1.33
0.1.32
0.1.31
0.1.30
0.1.29
0.1.28
0.1.27
0.1.26
0.1.25
0.1.24
0.1.23
0.1.22
0.1.21
0.1.20
0.1.2
0.1.19
0.1.18
0.1.17
0.1.16
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.0.2
توضیحات
Amazon EFS assets from Github repositories or S3 buckets
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cdk-efs-assets-0.3.95 |
| نام | cdk-efs-assets |
| نسخه کتابخانه | 0.3.95 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Pahud Hsieh<pahudnet@gmail.com> |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/pahud/cdk-efs-assets.git |
| آدرس اینترنتی | https://pypi.org/project/cdk-efs-assets/ |
| مجوز | Apache-2.0 |
[](https://badge.fury.io/js/cdk-efs-assets)
[](https://badge.fury.io/py/cdk-efs-assets)

# cdk-efs-assets
CDK construct library to populate Amazon EFS assets from Github or S3. If the source is S3, the construct also optionally supports updating the contents in EFS if a new zip file is uploaded to S3.
## Install
TypeScript/JavaScript:
```bash
npm i cdk-efs-assets
```
## SyncedAccessPoint
The main construct that is used to provide this EFS sync functionality is `SyncedAccessPoint`. This extends the standard EFS `AccessPoint` construct, and takes an additional `SyncSource` constructor property which defines the source to sync assets from. The `SyncedAccessPoint` instance can be used anywhere an `AccessPoint` can be used. For example, to specify a volume in a Task Definition:
```python
const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDefinition', {
...
volumes: [
{
name: 'efs-storage',
efsVolumeConfiguration: {
fileSystemId: sharedFileSystem.fileSystemId,
transitEncryption: 'ENABLED',
authorizationConfig: {
accessPointId: syncedAccessPoint.accessPointId
}
}
},
]
});
```
## Sync Engine
This library supports both `AWS Fargate` and `AWS Lambda` as the sync engine. As AWS Lambda currently has know issue with Amazon EFS([#100](https://github.com/pahud/cdk-efs-assets/issues/100)), the default sync engine is `AWS Fargate`. You can opt in AWS Lambda with the `engine` construct property of `SyncedAccessPoint`.
## Sync Source
Use `GithubSyncSource` and `S3ArchiveSyncSource` construct classes to define your `syncSource` from Github
or Amazon S3 bucket. For example:
To define a public github repository as the `syncSource`:
```python
new SyncedAccessPoint(stack, 'EfsAccessPoint', {
...
syncSource: new GithubSyncSource({
vpc,
repository: 'https://github.com/pahud/cdk-efs-assets.git',
}),
});
```
To define a private github repository as the `syncSource`:
```python
new SyncedAccessPoint(stack, 'EfsAccessPoint', {
...
syncSource: new GithubSyncSource({
vpc,
repository: 'https://github.com/pahud/private-repo.git',
secret: {
id: 'github',
key: 'oauth_token',
},
}),
});
```
### `syncDirectoryPath`
By default, the synced EFS assets are placed into a directory corresponding to the type of the sync source. For example, the default behavior of the GitHub source is to place the copied files into a directory named the same as the repository name (for a repository specified as 'https://github.com/pahud/cdk-efs-assets.git', the directory name would be 'cdk-efs-assets'), while the default behavior of the S3 archive source is to place the copied files into a directory named the same as the zip file (for a zip file name of 'assets.zip', the directory name would be 'assets').
If you wish to override this default behavior, specify a value for the `syncDirectoryPath` property that is passed into the `SyncSource` call.
If you are using the `AccessPoint` in an ECS/Fargate Task Definition, you probably will want to override the value of `syncDirectoryPath` to '/'. This will place the file contents in the root directory of the Access Point. The reason for this is that when you create a volume that is referencing an EFS Access Point, you are not allowed to specify any path other than the root directory in the task definition configuration.
## How to use SyncedAccessPoint initialized with files provisioned from GitHub repository
This will sync assets from a GitHub repository to a directory (by default, the output directory is named after the repository name) in the EFS AccessPoint:
```python
import { SyncSource, SyncedAccessPoint } from 'cdk-efs-assets';
const app = new App();
const env = {
region: process.env.CDK_DEFAULT_REGION ?? AWS_DEFAULT_REGION,
account: process.env.CDK_DEFAULT_ACCOUNT,
};
const stack = new Stack(app, 'testing-stack', { env });
const vpc = ec2.Vpc.fromLookup(stack, 'Vpc', { isDefault: true })
const fileSystem = new efs.FileSystem(stack, 'Filesystem', {
vpc,
removalPolicy: RemovalPolicy.DESTROY,
})
const efsAccessPoint = new SyncedAccessPoint(stack, 'GithubAccessPoint', {
vpc,
fileSystem,
path: '/demo-github',
createAcl: {
ownerGid: '1001',
ownerUid: '1001',
permissions: '0755',
},
posixUser: {
uid: '1001',
gid: '1001',
},
syncSource: new GithubSyncSource({
vpc,
repository: 'https://github.com/pahud/cdk-efs-assets.git',
})
});
```
### Github private repository support
To clone a github private repository, you need to generate your github **PAT(Personal Access Token)** and store the token in **AWS Secrets Manager** secret.
For example, if your PAT is stored in the AWS Secret manager with the secret ID `github` and the key `oauth_token`, you can specify the `secret` property as the sample below. Under the covers the lambda function will format the full github repository uri with your **PAT** and successfully git clone the private repository to the efs filesystem.
Store your PAT into the AWS Secrets Manager with AWS CLI:
```sh
aws secretsmanager create-secret \
--name github \
--secret-string '{"oauth_token":"MYOAUTHTOKEN"}'
```
Configure the `secret` property to allow lambda to retrieve the **PAT** from the secret:
```python
new GithubSyncSource({
vpc,
repository: 'https://github.com/username/repo.git',
secret: {
id: 'github',
key: 'oauth_token',
},
})
```
## How to use SyncedAccessPoint initialized with files provisioned from zip file stored in S3
This will sync assets from a zip file stored in an S3 bucket to a directory (by default, the output directory is named after the zip file name) in the EFS AccessPoint:
```python
import { S3ArchiveSync } from 'cdk-efs-assets';
const app = new App();
const env = {
region: process.env.CDK_DEFAULT_REGION ?? AWS_DEFAULT_REGION,
account: process.env.CDK_DEFAULT_ACCOUNT,
};
const stack = new Stack(app, 'testing-stack', { env });
const vpc = ec2.Vpc.fromLookup(stack, 'Vpc', { isDefault: true })
const fileSystem = new efs.FileSystem(stack, 'Filesystem', {
vpc,
removalPolicy: RemovalPolicy.DESTROY,
})
const bucket = Bucket.fromBucketName(this, 'Bucket', 'demo-bucket');
const efsAccessPoint = new SyncedAccessPoint(stack, 'EfsAccessPoint', {
vpc,
fileSystem,
path: '/demo-s3',
createAcl: {
ownerGid: '1001',
ownerUid: '1001',
permissions: '0755',
},
posixUser: {
uid: '1001',
gid: '1001',
},
syncSource: new S3ArchiveSyncSource({
vpc,
bucket,
zipFilePath: 'folder/foo.zip',
}),
});
```
### syncOnUpdate
If the `syncOnUpdate` property is set to `true` (defaults to `true`), then the specified zip file path will be monitored, and if a new object is uploaded to the path, then it will resync the data to EFS. Note that to use this functionality, you must have a CloudTrail Trail in your account that captures the desired S3 write data event.
This feature is only available with the `LAMBDA` sync engine.
*WARNING*: The contents of the extraction directory in the access point will be destroyed before extracting the zip file.
# `StatefulFargateNginx`
This library comes with `StatefulFargateNginx` construct which allows you to build an Amazon EFS-backed stateful
AWS Fargate service with its document root seeded from any github repository.
See this [tweet](https://twitter.com/pahudnet/status/1367792169063354371) for the demo.
Sample:
```python
new StatefulFargateNginx(this, 'NyanCat', {
vpc,
github: 'https://github.com/cristurm/nyan-cat.git',
});
```
نیازمندی
| مقدار | نام |
|---|---|
| <3.0.0,>=2.1.0 | aws-cdk-lib |
| <3.0.0,>=2.0.292 | cdk-fargate-run-task |
| <11.0.0,>=10.0.5 | constructs |
| <2.0.0,>=1.75.0 | jsii |
| >=0.0.3 | publication |
| ~=2.13.3 | typeguard |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| ~=3.7 | Python |
نحوه نصب
نصب پکیج whl cdk-efs-assets-0.3.95:
pip install cdk-efs-assets-0.3.95.whl
نصب پکیج tar.gz cdk-efs-assets-0.3.95:
pip install cdk-efs-assets-0.3.95.tar.gz