sam deploy failing with error桶在这个区域:us-east-2.请使用这个区域到us-eas



我是新来的。

我正在运行aws-cli/2.1.37 Python/3.8.8 Darwin/19.6.0 exe/x86_64 prompt/off

SAM CLI, version 1.29.0

参见下面的模板。yaml文件

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Trikle
Sample SAM Template for Trikle
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 60
Resources:
PutProfileFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
FunctionName: PutProfile
Description: Created With SAM Framework adds users profiles
Role: arn:aws:iam::630589988206:role/lambdaAllQueryExecutionAllAccessRole
CodeUri: src/
Handler: add_profile.lambda_handler
Runtime: python3.7
Events:
PutProfile:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /PutProfile
Method: post
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
PutProfileApi:
Description: "API Gateway endpoint URL for Prod stage for PutProfile function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/dev/PutProfile/"
PutProfileFunction:
Description: "Created With SAM Framework adds users profiles Lambda Function ARN"
Value: !GetAtt PutProfileFunction.Arn

尝试使用SAM将lambda函数和api网关部署到云的形成框架首先,我运行命令"sam package"项目成功部署到我的s3桶中。但是在运行"相同的部署"之后;它失败。桶在这个区域:us-east-2。请使用此区域us-east-2

查看下面发出命令sam deploy——template-file deploy后的错误的完整堆栈跟踪。yaml——stack-name myStack4

Deploying with following values
===============================
Stack name                   : mikeStack4
Region                       : None
Confirm changeset            : False
Deployment s3 bucket         : None
Capabilities                 : null
Parameter overrides          : {}
Signing Profiles             : {}
Initiating deployment
=====================
Waiting for changeset to be created..
CloudFormation stack changeset
-------------------------------------------------------------------------------------------------------------------------
Operation                      LogicalResourceId              ResourceType                   Replacement                  
-------------------------------------------------------------------------------------------------------------------------
+ Add                          PutProfileFunctionPutProfile   AWS::Lambda::Permission        N/A                          
PermissionProd                                                                             
+ Add                          PutProfileFunction             AWS::Lambda::Function          N/A                          
+ Add                          ServerlessRestApiDeployment7   AWS::ApiGateway::Deployment    N/A                          
5e148f6d0                                                                                  
+ Add                          ServerlessRestApiProdStage     AWS::ApiGateway::Stage         N/A                          
+ Add                          ServerlessRestApi              AWS::ApiGateway::RestApi       N/A                          
-------------------------------------------------------------------------------------------------------------------------
Changeset created successfully. arn:aws:cloudformation:us-west-2:630589988206:changeSet/samcli-deploy1630606751/c1aa856f-4259-4a2d-a4cc-c6a738fb1865

2021-09-02 19:19:19 - Waiting for stack create/update to complete
CloudFormation events from changeset
-------------------------------------------------------------------------------------------------------------------------
ResourceStatus                 ResourceType                   LogicalResourceId              ResourceStatusReason         
-------------------------------------------------------------------------------------------------------------------------
CREATE_IN_PROGRESS             AWS::Lambda::Function          PutProfileFunction             -                            
CREATE_IN_PROGRESS             AWS::Lambda::Function          PutProfileFunction             Resource creation Initiated  
ROLLBACK_IN_PROGRESS           AWS::CloudFormation::Stack     mikeStack4                     The following resource(s)    
                       failed to create:            
                       [PutProfileFunction].        
                       Rollback requested by user.  
CREATE_FAILED                  AWS::Lambda::Function          PutProfileFunction             Resource handler returned    
                       message: "Error occurred     
                       while GetObject. S3 Error    
                       Code: PermanentRedirect. S3  
                       Error Message: The bucket is 
                       in this region: us-east-2.   
                       Please use this region to    
                       retry the request (Service:  
                       Lambda, Status Code: 400,    
                       Request ID: 9edeeae4-ecd4-4d 
                       58-baec-7bef421657e3,        
                       Extended Request ID: null)"  
                       (RequestToken: 1238ab0d-1fc9 
                       -4f8f-9965-4f41d71e5804,     
                       HandlerErrorCode:            
                       InvalidRequest)              
DELETE_IN_PROGRESS             AWS::Lambda::Function          PutProfileFunction             -                            
ROLLBACK_COMPLETE              AWS::CloudFormation::Stack     mikeStack4                     -                            
DELETE_COMPLETE                AWS::Lambda::Function          PutProfileFunction             -                            
-------------------------------------------------------------------------------------------------------------------------
Error: Failed to create/update the stack: mikeStack4, Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression "Stacks[].StackStatus" we matched expected path: "ROLLBACK_COMPLETE" at least once

问题出在我的AWS CLI配置中的区域

我运行命令AWS configure并将区域重置为建议的

,部署成功

相关内容

最新更新