Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- evan@ArchScythe ~/Downloads
- $ mkdir sam-helloworld
- evan@ArchScythe ~/Downloads
- $ cd sam-helloworld/
- evan@ArchScythe ~/Do/sam-helloworld
- $ virtualenv venv
- Using base prefix '/usr'
- New python executable in /home/evan/Downloads/sam-helloworld/venv/bin/python
- Installing setuptools, pip, wheel...
- done.
- evan@ArchScythe ~/Do/sam-helloworld
- $ source venv/bin/activate.fish
- (venv) evan@ArchScythe ~/Do/sam-helloworld
- $ pip install aws-sam-cli
- Collecting aws-sam-cli
- Using cached https://files.pythonhosted.org/packages/17/c5/8965471506ebf7093119e2d1319a60a85d421586ef65bdbdc1a743436d3b/aws_sam_cli-0.21.0-py3-none-any.whl
- Collecting cookiecutter~=1.6.0 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/16/99/1ca3a75978270288354f419e9166666801cf7e7d8df984de44a7d5d8b8d0/cookiecutter-1.6.0-py2.py3-none-any.whl
- Collecting serverlessrepo==0.1.9 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/69/a8/3500d8ecd5e14a94b771e5f78a35313f94232cbde41b37888ce88fd9e07c/serverlessrepo-0.1.9-py2.py3-none-any.whl
- Collecting aws-lambda-builders==0.4.0 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/84/c4/408668c8289ba74f03ed6e8015499248e3990629cb85d97e0f72e4bee421/aws_lambda_builders-0.4.0-py3-none-any.whl
- Collecting chevron~=0.12 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/a3/1e/6ef58385f54c5bbf70b3b451930015aa2d30b3cd5ae324bba4da77c5b889/chevron-0.13.1-py3-none-any.whl
- Collecting requests==2.22.0 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
- Collecting Flask~=1.0.2 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/d8/94/7350820ae209ccdba073f83220cea1c376f2621254d1e0e82609c9a65e58/Flask-1.0.4-py2.py3-none-any.whl
- Collecting python-dateutil~=2.6 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl
- Collecting aws-sam-translator==1.11.0 (from aws-sam-cli)
- Collecting boto3>=1.9.56,~=1.9 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/16/e4/91e772079f1a5f48262da2d47136eb96a14348f320a96382ecff3aaaf7c9/boto3-1.9.228-py2.py3-none-any.whl
- Collecting docker~=4.0 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/95/47/5560c9cf0c92b50da24216f0e7733250fbed5a497f69e3c70e1be62143fe/docker-4.0.2-py2.py3-none-any.whl
- Collecting click~=7.0 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
- Collecting PyYAML~=5.1 (from aws-sam-cli)
- Collecting six~=1.11.0 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
- Collecting dateparser~=0.7 (from aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/a0/30/5cb8bb214c0b111fb59137c2e19c636a136209dbe45e1c3e9d63f7a76c1a/dateparser-0.7.1-py2.py3-none-any.whl
- Collecting binaryornot>=0.2.0 (from cookiecutter~=1.6.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/24/7e/f7b6f453e6481d1e233540262ccbfcf89adcd43606f44a028d7f5fae5eb2/binaryornot-0.4.4-py2.py3-none-any.whl
- Collecting future>=0.15.2 (from cookiecutter~=1.6.0->aws-sam-cli)
- Collecting jinja2>=2.7 (from cookiecutter~=1.6.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl
- Collecting whichcraft>=0.4.0 (from cookiecutter~=1.6.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/b5/a2/81887a0dae2e4d2adc70d9a3557fdda969f863ced51cd3c47b587d25bce5/whichcraft-0.6.1-py2.py3-none-any.whl
- Collecting jinja2-time>=0.1.0 (from cookiecutter~=1.6.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/6a/a1/d44fa38306ffa34a7e1af09632b158e13ec89670ce491f8a15af3ebcb4e4/jinja2_time-0.2.0-py2.py3-none-any.whl
- Collecting poyo>=0.1.0 (from cookiecutter~=1.6.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/42/50/0b0820601bde2eda403f47b9a4a1f270098ed0dd4c00c443d883164bdccc/poyo-0.5.0-py2.py3-none-any.whl
- Requirement already satisfied: wheel in ./venv/lib/python3.7/site-packages (from aws-lambda-builders==0.4.0->aws-sam-cli) (0.33.6)
- Requirement already satisfied: setuptools in ./venv/lib/python3.7/site-packages (from aws-lambda-builders==0.4.0->aws-sam-cli) (41.2.0)
- Collecting certifi>=2017.4.17 (from requests==2.22.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl
- Collecting idna<2.9,>=2.5 (from requests==2.22.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
- Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests==2.22.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/e6/60/247f23a7121ae632d62811ba7f273d0e58972d75e58a94d329d51550a47d/urllib3-1.25.3-py2.py3-none-any.whl
- Collecting chardet<3.1.0,>=3.0.2 (from requests==2.22.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
- Collecting itsdangerous>=0.24 (from Flask~=1.0.2->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
- Collecting Werkzeug>=0.14 (from Flask~=1.0.2->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/b7/61/c0a1adf9ad80db012ed7191af98fa05faa95fa09eceb71bb6fa8b66e6a43/Werkzeug-0.15.6-py2.py3-none-any.whl
- Collecting jsonschema~=2.6 (from aws-sam-translator==1.11.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl
- Collecting botocore<1.13.0,>=1.12.228 (from boto3>=1.9.56,~=1.9->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/f7/5c/b66a2241e5030c491f982c6b9646c008559aa7cd7f4448f643e8ed9f15e5/botocore-1.12.228-py2.py3-none-any.whl
- Collecting jmespath<1.0.0,>=0.7.1 (from boto3>=1.9.56,~=1.9->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/83/94/7179c3832a6d45b266ddb2aac329e101367fbdb11f425f13771d27f225bb/jmespath-0.9.4-py2.py3-none-any.whl
- Collecting s3transfer<0.3.0,>=0.2.0 (from boto3>=1.9.56,~=1.9->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/16/8a/1fc3dba0c4923c2a76e1ff0d52b305c44606da63f718d14d3231e21c51b0/s3transfer-0.2.1-py2.py3-none-any.whl
- Collecting websocket-client>=0.32.0 (from docker~=4.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/29/19/44753eab1fdb50770ac69605527e8859468f3c0fd7dc5a76dd9c4dbd7906/websocket_client-0.56.0-py2.py3-none-any.whl
- Collecting regex (from dateparser~=0.7->aws-sam-cli)
- Collecting pytz (from dateparser~=0.7->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/87/76/46d697698a143e05f77bec5a526bf4e56a0be61d63425b68f4ba553b51f2/pytz-2019.2-py2.py3-none-any.whl
- Collecting tzlocal (from dateparser~=0.7->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/ef/99/53bd1ac9349262f59c1c421d8fcc2559ae8a5eeffed9202684756b648d33/tzlocal-2.0.0-py2.py3-none-any.whl
- Collecting MarkupSafe>=0.23 (from jinja2>=2.7->cookiecutter~=1.6.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/98/7b/ff284bd8c80654e471b769062a9b43cc5d03e7a615048d96f4619df8d420/MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl
- Collecting arrow (from jinja2-time>=0.1.0->cookiecutter~=1.6.0->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/cc/f5/f618f8423fe674a60461e58683edfeead93f4bbf95b9fca0e9699e765b35/arrow-0.15.2-py2.py3-none-any.whl
- Collecting docutils<0.16,>=0.10 (from botocore<1.13.0,>=1.12.228->boto3>=1.9.56,~=1.9->aws-sam-cli)
- Using cached https://files.pythonhosted.org/packages/22/cd/a6aa959dca619918ccb55023b4cb151949c64d4d5d55b3f4ffd7eee0c6e8/docutils-0.15.2-py3-none-any.whl
- Installing collected packages: chardet, binaryornot, click, future, MarkupSafe, jinja2, certifi, idna, urllib3, requests, whichcraft, six, python-dateutil, arrow, jinja2-time, poyo, cookiecutter, docutils, jmespath, botocore, s3transfer, boto3, PyYAML, serverlessrepo, aws-lambda-builders, chevron, itsdangerous, Werkzeug, Flask, jsonschema, aws-sam-translator, websocket-client, docker, regex, pytz, tzlocal, dateparser, aws-sam-cli
- Successfully installed Flask-1.0.4 MarkupSafe-1.1.1 PyYAML-5.1.2 Werkzeug-0.15.6 arrow-0.15.2 aws-lambda-builders-0.4.0 aws-sam-cli-0.21.0 aws-sam-translator-1.11.0 binaryornot-0.4.4 boto3-1.9.228 botocore-1.12.228 certifi-2019.9.11 chardet-3.0.4 chevron-0.13.1 click-7.0 cookiecutter-1.6.0 dateparser-0.7.1 docker-4.0.2 docutils-0.15.2 future-0.17.1 idna-2.8 itsdangerous-1.1.0 jinja2-2.10.1 jinja2-time-0.2.0 jmespath-0.9.4 jsonschema-2.6.0 poyo-0.5.0 python-dateutil-2.8.0 pytz-2019.2 regex-2019.8.19 requests-2.22.0 s3transfer-0.2.1 serverlessrepo-0.1.9 six-1.11.0 tzlocal-2.0.0 urllib3-1.25.3 websocket-client-0.56.0 whichcraft-0.6.1
- (venv) evan@ArchScythe ~/Do/sam-helloworld
- $ sam init --runtime python3.7
- [+] Initializing project structure...
- Project generated: ./sam-app
- Steps you can take next within the project folder
- ===================================================
- [*] Invoke Function: sam local invoke HelloWorldFunction --event event.json
- [*] Start API Gateway locally: sam local start-api
- Read sam-app/README.md for further instructions
- [*] Project initialization is now complete
- (venv) evan@ArchScythe ~/Do/sam-helloworld
- $ ls
- sam-app venv
- (venv) evan@ArchScythe ~/Do/sam-helloworld
- $ cd sam-app
- (venv) evan@ArchScythe ~/Do/sa/sam-app
- $ sam build
- Building resource 'HelloWorldFunction'
- Running PythonPipBuilder:ResolveDependencies
- Running PythonPipBuilder:CopySource
- Build Succeeded
- Built Artifacts : .aws-sam/build
- Built Template : .aws-sam/build/template.yaml
- Commands you can use next
- =========================
- [*] Invoke Function: sam local invoke
- [*] Package: sam package --s3-bucket <yourbucket>
- (venv) evan@ArchScythe ~/Do/sa/sam-app
- $ sam local invoke HelloWorldFunction --event events/event.json
- Invoking app.lambda_handler (python3.7)
- 2019-09-15 12:11:16 Found credentials in AWS_CREDENTIAL_FILE.
- Fetching lambci/lambda:python3.7 Docker container image......
- Mounting /home/evan/Downloads/sam-helloworld/sam-app/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container
- Traceback (most recent call last):
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/docker/api/client.py", line 261, in _raise_for_status
- response.raise_for_status()
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
- raise HTTPError(http_error_msg, response=self)
- requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.35/containers/51af2a1c32718a46e283c28e18445706d22be43989a7da476a2798e2b168f191/start
- During handling of the above exception, another exception occurred:
- Traceback (most recent call last):
- File "/home/evan/Downloads/sam-helloworld/venv/bin/sam", line 10, in <module>
- sys.exit(cli())
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/click/core.py", line 764, in __call__
- return self.main(*args, **kwargs)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/click/core.py", line 717, in main
- rv = self.invoke(ctx)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
- return _process_result(sub_ctx.command.invoke(sub_ctx))
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
- return _process_result(sub_ctx.command.invoke(sub_ctx))
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/click/core.py", line 956, in invoke
- return ctx.invoke(self.callback, **ctx.params)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/click/core.py", line 555, in invoke
- return callback(*args, **kwargs)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
- return ctx.invoke(f, obj, *args, **kwargs)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/click/core.py", line 555, in invoke
- return callback(*args, **kwargs)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/samcli/lib/telemetry/metrics.py", line 94, in wrapped
- raise exception # pylint: disable=raising-bad-type
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/samcli/lib/telemetry/metrics.py", line 65, in wrapped
- return_value = func(*args, **kwargs)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/samcli/commands/local/invoke/cli.py", line 58, in cli
- parameter_overrides) # pragma: no cover
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/samcli/commands/local/invoke/cli.py", line 102, in do_cli
- stderr=context.stderr)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 93, in invoke
- self.local_runtime.invoke(config, event, debug_context=self.debug_context, stdout=stdout, stderr=stderr)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/samcli/local/lambdafn/runtime.py", line 86, in invoke
- self._container_manager.run(container)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/samcli/local/docker/manager.py", line 98, in run
- container.start(input_data=input_data)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/samcli/local/docker/container.py", line 189, in start
- real_container.start()
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/docker/models/containers.py", line 400, in start
- return self.client.api.start(self.id, **kwargs)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
- return f(self, resource_id, *args, **kwargs)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/docker/api/container.py", line 1093, in start
- self._raise_for_status(res)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/docker/api/client.py", line 263, in _raise_for_status
- raise create_api_error_from_http_exception(e)
- File "/home/evan/Downloads/sam-helloworld/venv/lib/python3.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
- raise cls(e, response=response, explanation=explanation)
- docker.errors.APIError: 400 Client Error: Bad Request ("OCI runtime create failed: container_linux.go:345: starting container process caused "chdir to cwd (\"/var/task\") set in config.json failed: permission denied": unknown")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement