cdk-lambda-bash-2.0.99
2.0.99
2.0.98
2.0.97
2.0.96
2.0.95
2.0.94
2.0.93
2.0.92
2.0.91
2.0.90
2.0.9
2.0.89
2.0.88
2.0.87
2.0.86
2.0.85
2.0.84
2.0.83
2.0.82
2.0.81
2.0.80
2.0.8
2.0.79
2.0.78
2.0.77
2.0.76
2.0.75
2.0.74
2.0.73
2.0.72
2.0.71
2.0.70
2.0.7
2.0.69
2.0.68
2.0.67
2.0.66
2.0.65
2.0.64
2.0.63
2.0.62
2.0.61
2.0.60
2.0.6
2.0.59
2.0.58
2.0.57
2.0.56
2.0.55
2.0.54
2.0.53
2.0.52
2.0.51
2.0.50
2.0.5
2.0.49
2.0.48
2.0.47
2.0.46
2.0.45
2.0.44
2.0.43
2.0.42
2.0.41
2.0.40
2.0.4
2.0.39
2.0.38
2.0.37
2.0.36
2.0.35
2.0.34
2.0.33
2.0.326
2.0.325
2.0.324
2.0.323
2.0.322
2.0.321
2.0.320
2.0.32
2.0.319
2.0.318
2.0.317
2.0.316
2.0.315
2.0.314
2.0.313
2.0.312
2.0.311
2.0.310
2.0.31
2.0.309
2.0.308
2.0.307
2.0.306
2.0.305
2.0.304
2.0.303
2.0.302
2.0.301
2.0.300
2.0.30
2.0.3
2.0.299
2.0.298
2.0.297
2.0.296
2.0.295
2.0.294
2.0.293
2.0.292
2.0.291
2.0.290
2.0.29
2.0.289
2.0.288
2.0.287
2.0.286
2.0.285
2.0.284
2.0.283
2.0.282
2.0.281
2.0.280
2.0.28
2.0.279
2.0.278
2.0.277
2.0.276
2.0.275
2.0.274
2.0.273
2.0.272
2.0.271
2.0.270
2.0.27
2.0.269
2.0.268
2.0.267
2.0.266
2.0.265
2.0.264
2.0.263
2.0.262
2.0.261
2.0.260
2.0.26
2.0.259
2.0.258
2.0.257
2.0.256
2.0.255
2.0.254
2.0.253
2.0.252
2.0.251
2.0.250
2.0.25
2.0.249
2.0.248
2.0.247
2.0.246
2.0.245
2.0.244
2.0.243
2.0.242
2.0.241
2.0.240
2.0.24
2.0.239
2.0.238
2.0.237
2.0.236
2.0.235
2.0.234
2.0.233
2.0.232
2.0.231
2.0.230
2.0.23
2.0.229
2.0.228
2.0.227
2.0.226
2.0.225
2.0.224
2.0.223
2.0.222
2.0.221
2.0.220
2.0.22
2.0.219
2.0.218
2.0.217
2.0.216
2.0.215
2.0.214
2.0.213
2.0.212
2.0.211
2.0.210
2.0.21
2.0.209
2.0.208
2.0.207
2.0.206
2.0.205
2.0.204
2.0.203
2.0.202
2.0.201
2.0.200
2.0.20
2.0.2
2.0.199
2.0.198
2.0.197
2.0.196
2.0.195
2.0.194
2.0.193
2.0.192
2.0.191
2.0.190
2.0.19
2.0.189
2.0.188
2.0.187
2.0.186
2.0.185
2.0.184
2.0.183
2.0.182
2.0.181
2.0.180
2.0.18
2.0.179
2.0.178
2.0.177
2.0.176
2.0.175
2.0.174
2.0.173
2.0.172
2.0.170
2.0.17
2.0.169
2.0.168
2.0.167
2.0.166
2.0.165
2.0.164
2.0.163
2.0.162
2.0.161
2.0.160
2.0.159
2.0.158
2.0.157
2.0.156
2.0.155
2.0.154
2.0.153
2.0.152
2.0.151
2.0.150
2.0.149
2.0.148
2.0.147
2.0.146
2.0.145
2.0.144
2.0.143
2.0.142
2.0.141
2.0.140
2.0.139
2.0.138
2.0.137
2.0.136
2.0.135
2.0.134
2.0.133
2.0.132
2.0.131
2.0.130
2.0.13
2.0.129
2.0.128
2.0.127
2.0.126
2.0.125
2.0.124
2.0.123
2.0.122
2.0.121
2.0.120
2.0.12
2.0.119
2.0.118
2.0.117
2.0.116
2.0.115
2.0.114
2.0.113
2.0.112
2.0.111
2.0.110
2.0.11
2.0.109
2.0.108
2.0.107
2.0.106
2.0.105
2.0.104
2.0.103
2.0.102
2.0.101
2.0.100
2.0.10
2.0.1
2.0.0
0.5.99
0.5.98
0.5.97
0.5.96
0.5.95
0.5.94
0.5.93
0.5.92
0.5.91
0.5.90
0.5.89
0.5.88
0.5.87
0.5.86
0.5.85
0.5.84
0.5.83
0.5.82
0.5.81
0.5.80
0.5.79
0.5.78
0.5.77
0.5.76
0.5.75
0.5.74
0.5.73
0.5.72
0.5.71
0.5.70
0.5.69
0.5.68
0.5.67
0.5.66
0.5.65
0.5.64
0.5.63
0.5.62
0.5.61
0.5.60
0.5.6
0.5.59
0.5.58
0.5.57
0.5.56
0.5.55
0.5.54
0.5.53
0.5.52
0.5.51
0.5.50
0.5.5
0.5.49
0.5.48
0.5.47
0.5.46
0.5.45
0.5.44
0.5.43
0.5.42
0.5.41
0.5.40
0.5.4
0.5.39
0.5.38
0.5.37
0.5.36
0.5.35
0.5.34
0.5.33
0.5.32
0.5.31
0.5.30
0.5.3
0.5.29
0.5.2
0.5.183
0.5.182
0.5.181
0.5.180
0.5.179
0.5.178
0.5.177
0.5.176
0.5.175
0.5.174
0.5.173
0.5.172
0.5.171
0.5.170
0.5.169
0.5.168
0.5.167
0.5.166
0.5.165
0.5.164
0.5.163
0.5.162
0.5.161
0.5.160
0.5.159
0.5.158
0.5.157
0.5.156
0.5.155
0.5.154
0.5.153
0.5.152
0.5.151
0.5.150
0.5.149
0.5.148
0.5.147
0.5.146
0.5.145
0.5.144
0.5.143
0.5.142
0.5.141
0.5.140
0.5.139
0.5.138
0.5.137
0.5.136
0.5.135
0.5.134
0.5.133
0.5.132
0.5.131
0.5.130
0.5.129
0.5.128
0.5.127
0.5.126
0.5.125
0.5.124
0.5.123
0.5.122
0.5.121
0.5.120
0.5.119
0.5.118
0.5.117
0.5.116
0.5.115
0.5.114
0.5.113
0.5.112
0.5.111
0.5.110
0.5.109
0.5.108
0.5.107
0.5.106
0.5.105
0.5.104
0.5.103
0.5.102
0.5.101
0.5.100
0.5.1
0.4.2
0.4.1
0.4.0
0.3.2
0.3.1
0.2.2
0.2.1
0.2.0
0.1.2
0.1.1
0.1.0
0.0.4
0.0.3
0.0.2
0.0.1
2.0.99
2.0.98
2.0.97
2.0.96
2.0.95
2.0.94
2.0.93
2.0.92
2.0.91
2.0.90
2.0.9
2.0.89
2.0.88
2.0.87
2.0.86
2.0.85
2.0.84
2.0.83
2.0.82
2.0.81
2.0.80
2.0.8
2.0.79
2.0.78
2.0.77
2.0.76
2.0.75
2.0.74
2.0.73
2.0.72
2.0.71
2.0.70
2.0.7
2.0.69
2.0.68
2.0.67
2.0.66
2.0.65
2.0.64
2.0.63
2.0.62
2.0.61
2.0.60
2.0.6
2.0.59
2.0.58
2.0.57
2.0.56
2.0.55
2.0.54
2.0.53
2.0.52
2.0.51
2.0.50
2.0.5
2.0.49
2.0.48
2.0.47
2.0.46
2.0.45
2.0.44
2.0.43
2.0.42
2.0.41
2.0.40
2.0.4
2.0.39
2.0.38
2.0.37
2.0.36
2.0.35
2.0.34
2.0.33
2.0.326
2.0.325
2.0.324
2.0.323
2.0.322
2.0.321
2.0.320
2.0.32
2.0.319
2.0.318
2.0.317
2.0.316
2.0.315
2.0.314
2.0.313
2.0.312
2.0.311
2.0.310
2.0.31
2.0.309
2.0.308
2.0.307
2.0.306
2.0.305
2.0.304
2.0.303
2.0.302
2.0.301
2.0.300
2.0.30
2.0.3
2.0.299
2.0.298
2.0.297
2.0.296
2.0.295
2.0.294
2.0.293
2.0.292
2.0.291
2.0.290
2.0.29
2.0.289
2.0.288
2.0.287
2.0.286
2.0.285
2.0.284
2.0.283
2.0.282
2.0.281
2.0.280
2.0.28
2.0.279
2.0.278
2.0.277
2.0.276
2.0.275
2.0.274
2.0.273
2.0.272
2.0.271
2.0.270
2.0.27
2.0.269
2.0.268
2.0.267
2.0.266
2.0.265
2.0.264
2.0.263
2.0.262
2.0.261
2.0.260
2.0.26
2.0.259
2.0.258
2.0.257
2.0.256
2.0.255
2.0.254
2.0.253
2.0.252
2.0.251
2.0.250
2.0.25
2.0.249
2.0.248
2.0.247
2.0.246
2.0.245
2.0.244
2.0.243
2.0.242
2.0.241
2.0.240
2.0.24
2.0.239
2.0.238
2.0.237
2.0.236
2.0.235
2.0.234
2.0.233
2.0.232
2.0.231
2.0.230
2.0.23
2.0.229
2.0.228
2.0.227
2.0.226
2.0.225
2.0.224
2.0.223
2.0.222
2.0.221
2.0.220
2.0.22
2.0.219
2.0.218
2.0.217
2.0.216
2.0.215
2.0.214
2.0.213
2.0.212
2.0.211
2.0.210
2.0.21
2.0.209
2.0.208
2.0.207
2.0.206
2.0.205
2.0.204
2.0.203
2.0.202
2.0.201
2.0.200
2.0.20
2.0.2
2.0.199
2.0.198
2.0.197
2.0.196
2.0.195
2.0.194
2.0.193
2.0.192
2.0.191
2.0.190
2.0.19
2.0.189
2.0.188
2.0.187
2.0.186
2.0.185
2.0.184
2.0.183
2.0.182
2.0.181
2.0.180
2.0.18
2.0.179
2.0.178
2.0.177
2.0.176
2.0.175
2.0.174
2.0.173
2.0.172
2.0.170
2.0.17
2.0.169
2.0.168
2.0.167
2.0.166
2.0.165
2.0.164
2.0.163
2.0.162
2.0.161
2.0.160
2.0.159
2.0.158
2.0.157
2.0.156
2.0.155
2.0.154
2.0.153
2.0.152
2.0.151
2.0.150
2.0.149
2.0.148
2.0.147
2.0.146
2.0.145
2.0.144
2.0.143
2.0.142
2.0.141
2.0.140
2.0.139
2.0.138
2.0.137
2.0.136
2.0.135
2.0.134
2.0.133
2.0.132
2.0.131
2.0.130
2.0.13
2.0.129
2.0.128
2.0.127
2.0.126
2.0.125
2.0.124
2.0.123
2.0.122
2.0.121
2.0.120
2.0.12
2.0.119
2.0.118
2.0.117
2.0.116
2.0.115
2.0.114
2.0.113
2.0.112
2.0.111
2.0.110
2.0.11
2.0.109
2.0.108
2.0.107
2.0.106
2.0.105
2.0.104
2.0.103
2.0.102
2.0.101
2.0.100
2.0.10
2.0.1
2.0.0
0.5.99
0.5.98
0.5.97
0.5.96
0.5.95
0.5.94
0.5.93
0.5.92
0.5.91
0.5.90
0.5.89
0.5.88
0.5.87
0.5.86
0.5.85
0.5.84
0.5.83
0.5.82
0.5.81
0.5.80
0.5.79
0.5.78
0.5.77
0.5.76
0.5.75
0.5.74
0.5.73
0.5.72
0.5.71
0.5.70
0.5.69
0.5.68
0.5.67
0.5.66
0.5.65
0.5.64
0.5.63
0.5.62
0.5.61
0.5.60
0.5.6
0.5.59
0.5.58
0.5.57
0.5.56
0.5.55
0.5.54
0.5.53
0.5.52
0.5.51
0.5.50
0.5.5
0.5.49
0.5.48
0.5.47
0.5.46
0.5.45
0.5.44
0.5.43
0.5.42
0.5.41
0.5.40
0.5.4
0.5.39
0.5.38
0.5.37
0.5.36
0.5.35
0.5.34
0.5.33
0.5.32
0.5.31
0.5.30
0.5.3
0.5.29
0.5.2
0.5.183
0.5.182
0.5.181
0.5.180
0.5.179
0.5.178
0.5.177
0.5.176
0.5.175
0.5.174
0.5.173
0.5.172
0.5.171
0.5.170
0.5.169
0.5.168
0.5.167
0.5.166
0.5.165
0.5.164
0.5.163
0.5.162
0.5.161
0.5.160
0.5.159
0.5.158
0.5.157
0.5.156
0.5.155
0.5.154
0.5.153
0.5.152
0.5.151
0.5.150
0.5.149
0.5.148
0.5.147
0.5.146
0.5.145
0.5.144
0.5.143
0.5.142
0.5.141
0.5.140
0.5.139
0.5.138
0.5.137
0.5.136
0.5.135
0.5.134
0.5.133
0.5.132
0.5.131
0.5.130
0.5.129
0.5.128
0.5.127
0.5.126
0.5.125
0.5.124
0.5.123
0.5.122
0.5.121
0.5.120
0.5.119
0.5.118
0.5.117
0.5.116
0.5.115
0.5.114
0.5.113
0.5.112
0.5.111
0.5.110
0.5.109
0.5.108
0.5.107
0.5.106
0.5.105
0.5.104
0.5.103
0.5.102
0.5.101
0.5.100
0.5.1
0.4.2
0.4.1
0.4.0
0.3.2
0.3.1
0.2.2
0.2.1
0.2.0
0.1.2
0.1.1
0.1.0
0.0.4
0.0.3
0.0.2
0.0.1
توضیحات
Deploy Bash Lambda Functions with AWS CDK
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cdk-lambda-bash-2.0.99 |
| نام | cdk-lambda-bash |
| نسخه کتابخانه | 2.0.99 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Pahud Hsieh |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/pahud/cdk-lambda-bash.git |
| آدرس اینترنتی | https://pypi.org/project/cdk-lambda-bash/ |
| مجوز | Apache-2.0 |
[](https://badge.fury.io/js/cdk-lambda-bash)
[](https://badge.fury.io/py/cdk-lambda-bash)
[](https://github.com/pahud/cdk-lambda-bash/actions/workflows/release.yml)
# cdk-lambda-bash
Deploy Bash Lambda Functions with AWS CDK
# Why
AWS Lambda has the [docker container image support](https://aws.amazon.com/tw/blogs/aws/new-for-aws-lambda-container-image-support/) since AWS re:Invent 2020 which allows you to run your Lambda code in a custom container image. Inspired by [nikovirtala/cdk-eks-experiment](https://github.com/nikovirtala/cdk-eks-experiment/), `cdk-lambda-bash` allows you to specify a local shell script and bundle it up as a custom resource in your cdk stack. On cdk deployment, your shell script will be executed in a Lambda container environment.
# BashExecFunction
At this moment, we are offering `BashExecFunction` construct class which is a high-level abstraction of `lambda.Function`. By defining the `script` property which poins to your local shell script, on `cdk deploy`, this script will be bundled into a custom docker image and published as a `lambda.DockerImageFunction`.
If you `fn.run()`, a custom resource will be created and the `lambda.DockerImageFunction` will be executed on deployment.
# Install
Use the npm dist tag to opt in CDKv1 or CDKv2:
```sh
// for CDKv2
npm install cdk-lambda-bash
or
npm install cdk-lambda-bash@latest
// for CDKv1
npm install cdk-lambda-bash@cdkv1
```
# Sample
```python
const app = new cdk.App();
const stack = new cdk.Stack(app, 'my-stack');
// bundle your Lambda function to execute the local demo.sh in container
const fn = new BashExecFunction(stack, 'Demo', {
script: path.join(__dirname, '../demo.sh'),
})
// run it as custom resource on deployment
fn.run();
```
## Re-execution on assets update
By default, if you update your shell script or Dockerfile and re-deploy your CDK application, the `BashExecFunction`
will not be re-executed. Use `runOnUpdate` to enable the re-execution on update.
```python
fn.run({ runOnUpdate: true });
```
## Custom Dockerfile
In some cases, you may customize your own `Dockerfile`, for instances:
1. You need extra tools or utilities such as `kubectl` or `helm`
2. You need build from your own base image
In these cases, create a custom `Dockerfile` as below and add extra utilities i.e. `kubectl`:
<details><summary>click and view custom Dockerfile sample</summary>
```bash
FROM public.ecr.aws/lambda/provided:al2
RUN yum install -y unzip jq
# install aws-cli v2
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install
# install kubectl
RUN curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/kubectl
COPY bootstrap /var/runtime/bootstrap
COPY function.sh /var/task/function.sh
COPY main.sh /var/task/main.sh
RUN chmod +x /var/runtime/bootstrap /var/task/function.sh /var/task/main.sh
WORKDIR /var/task
CMD [ "function.sh.handler" ]
```
</details>
Specify your own `Dockerfile` with the `dockerfile` property.
```python
new BashExecFunction(stack, 'Demo', {
script: path.join(__dirname, '../demo.sh'),
dockerfile: path.join(__dirname, '../Dockerfile'),
});
```
# Conditional Execution
In the user script(e.g. `demo.sh`), you are allowed to determine the event type and act accordingly.
For example
```python
const installArgoCD = new BashExecFunction(...)
installArgoCD.run({runOnUpdate: true});
```
When you run this sample, `demo.sh` will receive `onCreate` event and you can run your custom logic to "install ArgoCD" like `kubectl apply -f URL`. However, if you comment it off and deploy again:
```python
const installArgoCD = new BashExecFunction(...)
//installArgoCD.run({runOnUpdate: true});
```
Under the hood, `demo.sh` will receive `onDelete` event and you can run your custom logic to "uninstall ArgoCD"
like `kubectl delete -f URL`.
Check the full sample code below:
<details><summary>Click and view the sample code</summary>
```sh
#!/bin/bash
# implement your business logic below
function onCreate() {
echo "running kubectl apply -f ..."
}
function onUpdate() {
echo "do nothing on update"
}
function onDelete() {
echo "running kubectl delete -f ..."
}
function getRequestType() {
echo $1 | jq -r .RequestType
}
function conditionalExec() {
requestType=$(getRequestType $EVENT_DATA)
# determine the original request type
case $requestType in
'Create') onCreate $1 ;;
'Update') onUpdate $1 ;;
'Delete') onDelete $1 ;;
esac
}
echo "Hello cdk lambda bash!!"
conditionalExec
exit 0
```
</details>
# In Action
See this [tweet](https://twitter.com/pahudnet/status/1370301964836241408)


نیازمندی
| مقدار | نام |
|---|---|
| <3.0.0,>=2.0.0 | aws-cdk-lib |
| <11.0.0,>=10.0.5 | constructs |
| <2.0.0,>=1.78.1 | jsii |
| >=0.0.3 | publication |
| ~=2.13.3 | typeguard |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| ~=3.7 | Python |
نحوه نصب
نصب پکیج whl cdk-lambda-bash-2.0.99:
pip install cdk-lambda-bash-2.0.99.whl
نصب پکیج tar.gz cdk-lambda-bash-2.0.99:
pip install cdk-lambda-bash-2.0.99.tar.gz