・ So überprüfen Sie den Pfad von Python und Pip Fragen Sie beim Explorer nach
・ Hinzufügen eines Pfades Öffnen Sie Folgendes an der Eingabeaufforderung System und Sicherheit → System → Erweiterte Systemeinstellungen → Umgebungsvariablen Wählen Sie Pfad aus der Liste der Systemumgebungsvariablen aus und klicken Sie auf Bearbeiten
Wenn es keinen Pfad für Python und Pip gibt, erstellen Sie einen neuen
C:\Users\USER>pip install awscli
Defaulting to user installation because normal site-packages is not writeable
Collecting awscli
Downloading awscli-1.18.157-py2.py3-none-any.whl (3.4 MB)
|████████████████████████████████| 3.4 MB 504 kB/s
Installing collected packages: six, python-dateutil, jmespath, urllib3, botocore, PyYAML, pyasn1, rsa, s3transfer, colorama, docutils, awscli
WARNING: The scripts pyrsa-decrypt.exe, pyrsa-encrypt.exe, pyrsa-keygen.exe, pyrsa-priv2pub.exe, pyrsa-sign.exe and pyrsa-verify.exe are installed in 'C:\Users\USER\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed PyYAML-5.3.1 awscli-1.18.157 botocore-1.18.16 colorama-0.4.3 docutils-0.15.2 jmespath-0.10.0 pyasn1-0.4.8 python-dateutil-2.8.1 rsa-4.5 s3transfer-0.3.3 six-1.15.0 urllib3-1.25.10
WARNING: You are using pip version 20.1.1; however, version 20.2.3 is available.
You should consider upgrading via the 'c:\program files (x86)\microsoft visual studio\shared\python37_64\python.exe -m pip install --upgrade pip' command.
Die erste WARNUNG muss hinzugefügt werden, da der Pfad nicht übergeben wird Der hinzuzufügende Pfad ist in WARNUNG beschrieben
Die zweite WARNUNG ist eine Anleitung, die Sie mit einem einfachen Pip-Upgrade auf die neueste Version aktualisieren können
C:\Users\USER>aws configure --profile IoT AWS Access Key ID [None]: ### AWS Secret Access Key [None]: ### Default region name [None]: ap-northeast-1 Default output format [None]: json
Bestätigung nach dem Einstellen Bestätigung von ec2
aws ec2 describe-instances --instance-ids ${instance-id} --profile IoT
Bestätigung von S3
C:\Users\USER>aws s3 ls --profile IoT
2020-10-10 14:46:01 test7712121
Zuerst Task-Manager → Registerkarte Leistung → CPU Stellen Sie sicher, dass das Feld "Virtuell" unten rechts aktiviert ist.
Dokcer Desktop für Windows ist bei der Installation von Docker nicht in Windows 10 Home enthalten. Dieses Mal habe ich beschlossen, stattdessen Docker Toolbox zu installieren. Installieren Sie v19.03.1 von "Install Docker Toolbox for Windows" von der folgenden Site https://docs.docker.com/toolbox/overview/
Ich habe es installiert, ohne den Inhalt zu ändern.
Wenn während der Installation von Docker die folgende Installation angezeigt wird, installieren Sie sie.
Laden Sie das Installationsprogramm von unten herunter https://github.com/awslabs/aws-sam-cli/releases/download/v0.6.2/AWS_SAM_CLI_64_PY3.msi
Versionsbestätigungsbefehl
C:\Users\USER>sam --version
SAM CLI, version 0.6.2
Im Gegensatz zu dem Verhalten, das init dachte, konnte ich es nicht spezifizieren Wenn ich versuche zu bauen, bekomme ich eine Situation, in der ich nicht kann! !!
Eigentlich stellte sich heraus, dass die Installationsversion alt war, also Installieren Sie das neueste SAM und es wird gelöst!
Zuerst mit sam init unter Verwendung der AWS SAM-Vorlage Initialisieren Sie die serverlose Anwendung. Übrigens ist es nur beim ersten Mal in Ordnung, wenn Sie das Projekt ändern.
Diesmal ist die Einstellung : 1 - AWS Quick Start Templates Sprache: 8-Python3.7 Project name : test2 templates : 1 - Hello World Example
C:\Users\USER\test>sam init
Which template source would you like to use?
1 - AWS Quick Start Templates
2 - Custom Template Location
Choice: 1
Which runtime would you like to use?
1 - nodejs12.x
2 - python3.8
3 - ruby2.7
4 - go1.x
5 - java11
6 - dotnetcore3.1
7 - nodejs10.x
8 - python3.7
9 - python3.6
10 - python2.7
11 - ruby2.5
12 - java8.al2
13 - java8
14 - dotnetcore2.1
Runtime: 8
Project name [sam-app]: test2
Cloning app templates from https://github.com/awslabs/aws-sam-cli-app-templates.git
AWS quick start application templates:
1 - Hello World Example
2 - EventBridge Hello World
3 - EventBridge App from scratch (100+ Event Schemas)
4 - Step Functions Sample App (Stock Trader)
Template selection:
Template selection: 1
-----------------------
Generating application:
-----------------------
Name: test2
Runtime: python3.7
Dependency Manager: pip
Application Template: hello-world
Output Directory: .
Next steps can be found in the README file at ./test2/README.md
Diesmal konnte ich angeben, wie ich es erwartet hatte Führen Sie zum ersten Mal die Option --guided aus. Hier ist das Ergebnis von bilud und deploy start, aber es liegt wieder ein Fehler vor ...
C:\Users\USER\sam_test>sam build
Building codeuri: hello_world/ runtime: python3.7 metadata: {} functions: ['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
[*] Deploy: sam deploy --guided
sam deploy --guided --profile IoT
Configuring SAM deploy
======================
Looking for config file [samconfig.toml] : Not found
Setting default arguments for 'sam deploy'
=========================================
Stack Name [sam-app]: sam_test
AWS Region [us-east-1]: ap-northeast-1
#Shows you resources changes to be deployed and require a 'Y' to initiate deploy
Confirm changes before deploy [y/N]: N
#SAM needs permission to be able to create roles to connect to the resources in your template
Allow SAM CLI IAM role creation [Y/n]: Y
HelloWorldFunction may not have authorization defined, Is this okay? [y/N]: y
Save arguments to configuration file [Y/n]: Y
SAM configuration file [samconfig.toml]:
SAM configuration environment [default]:
Looking for resources needed for deployment: Not found.
Creating the required resources...
Successfully created!
Initiating deployment
=====================
HelloWorldFunction may not have authorization defined.
Uploading to sam_test/25efe53b4bac655770621572b615acba.template 1132 / 1132.0 (100.00%)
Error: Failed to create changeset for the stack: sam_test, An error occurred (ValidationError) when calling the CreateChangeSet operation: 1 validation error detected: Value 'sam_test' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*
Eigentlich war es ein Fehler, weil "_" aufgrund eines einfachen Fehlers nicht für stackName verwendet werden konnte. Ich habe es gelöst, indem ich den Inhalt der Datei samconfig.toml bearbeitet habe. Nach dem Reparieren erstellen und bereitstellen und es ist erfolgreich.