在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:NUS-ALSET/lambda-nbconvert开源软件地址:https://github.com/NUS-ALSET/lambda-nbconvert开源编程语言:HTML 58.1%开源软件介绍:AWS SAM JupyterAWS SAM project that allows invoking Jupyter notebooks dynamically using the AWS Lambda as the execution environment. Test your application locallyIf running the API for the first time, or when requirements.txt file was updated, the following script should be executed first:
It will install and build all dependencies against the Amazon Linux and will place them in the Use SAM Local to run your Lambda function locally:
The API will be running athttp://localhost:3000 DeployPreparationTo deploy this SAM project, an existing bucket is required in the target region. It can be created using AWS Management Console. To create an S3 bucket, use the instructions below:
DeploymentOnce the bucket is created, it can be used for the SAM deployment. Use the "deploy.sh" script and provide all the required parameters:
Bucket Name parameter should have the same value as the name of the bucket that was created in the previous step. Stack Name can be any alphanumeric value without spaces. Using some name for the first time creates a new CloudFormation stack, while all consequent execution of the scrip with the same name will update the corresponding CF stack rather than create a new one. Region must match the region of the bucket, created earlier. EnableCORS is an optional parameter that can have Yes or No value depending on whether the CORS should be allowed for this endpoint. Upload files that can be referenced by the notebookSelecting one or multiple files will encode those files using Base64 encoding and contents will be uploaded to the working directory of the Jupyter Notebook. The total size of all files should not exceed 3 MB in Base64 encoding. Selecting a single file will also put it's contents to the corresponding text field for further preview. Implementation detailsCORS SupportTo enable cross-origin requests (requests from domains, different from the API domain), a CORS support was implemented. CORS is enabled by default and can be configured using various parameters of the stack:
Default values should work in most of the cases. EnableCORS parameter can be supplied via the command line, as it explained in the "Deployment" section of the readme. Dynamic CORS configuration is achieved by populating response headers programmatically (see the main.py file). Enabled/disabled state is being read from Lambda environment variables, with a default value of 'true' (note it's a string and not a boolean, since the value is passed as an environment variable):
In a case if CORS is enabled, a CORS preflight request/response is implemented:
And finally, the POST response is being populated with proper CORS headers if CORS is enabled:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论