mirror of
https://github.com/donnemartin/data-science-ipython-notebooks.git
synced 2024-03-22 13:30:56 +08:00
Added Lambda commands.
This commit is contained in:
parent
cd84ffb2f0
commit
5600ab0377
162
aws/aws.ipynb
162
aws/aws.ipynb
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:6bd9f74232672cb4b50a0a1b5a5abd778aefd1ee3da04b9643d730eb97896b73"
|
||||
"signature": "sha256:7778453219a7e893528fae53a5bba1a4a5dcc071d59b328be018de36dcd7945b"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
|
@ -20,7 +20,8 @@
|
|||
"* S3DistCp\n",
|
||||
"* mrjob\n",
|
||||
"* Redshift\n",
|
||||
"* Kinesis"
|
||||
"* Kinesis\n",
|
||||
"* Lambda"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -665,7 +666,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Kinesis"
|
||||
"<h2 id=\"kinesis\">Kinesis</h2>"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -770,6 +771,161 @@
|
|||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"lambda\">Lambda</h2>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"List lambda functions:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"aws lambda list-functions \\\n",
|
||||
" --region us-east-1 \\\n",
|
||||
" --max-items 10"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Upload a lambda function:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"aws lambda upload-function \\\n",
|
||||
" --region us-east-1 \\\n",
|
||||
" --function-name foo \\\n",
|
||||
" --function-zip file-path/foo.zip \\\n",
|
||||
" --role IAM-role-ARN \\\n",
|
||||
" --mode event \\\n",
|
||||
" --handler foo.handler \\\n",
|
||||
" --runtime nodejs \\\n",
|
||||
" --debug"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Invoke a lambda function:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"aws lambda invoke-async \\\n",
|
||||
" --function-name foo \\\n",
|
||||
" --region us-east-1 \\\n",
|
||||
" --invoke-args foo.txt \\\n",
|
||||
" --debug"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Return metadata for a specific function:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"aws lambda get-function-configuration \\\n",
|
||||
" --function-name helloworld \\\n",
|
||||
" --region us-east-1 \\\n",
|
||||
" --debug"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Return metadata for a specific function along with a presigned URL that you can use to download the function's .zip file that you uploaded:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"aws lambda get-function \\\n",
|
||||
" --function-name helloworld \\\n",
|
||||
" --region us-east-1 \\\n",
|
||||
" --debug"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Add an event source:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"aws lambda add-event-source \\\n",
|
||||
" --region us-east-1 \\\n",
|
||||
" --function-name ProcessKinesisRecords \\\n",
|
||||
" --role invocation-role-arn \\\n",
|
||||
" --event-source kinesis-stream-arn \\\n",
|
||||
" --batch-size 100 \\\n",
|
||||
" --profile adminuser"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Delete a lambda function:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"aws lambda delete-function \\\n",
|
||||
" --function-name helloworld \\\n",
|
||||
" --region us-east-1 \\\n",
|
||||
" --debug"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user