Bug: AWS Sam Hello World Failed with AdministratorAccess
See original GitHub issueDescription:
I have some templates that fail to work with sam, but work with Cloudformation GUI Retry. I tried a lot of things and it turns out that I cannot even work with Hello World example now. I am using my own account with AdministratorAccess policy
Steps to reproduce:
sam init
Which template source would you like to use?
1 - AWS Quick Start Templates
2 - Custom Template Location
Choice: 1
Choose an AWS Quick Start application template
1 - Hello World Example
2 - Multi-step workflow
3 - Serverless API
4 - Scheduled task
5 - Standalone function
6 - Data processing
7 - Infrastructure event management
8 - Machine Learning
Template: 1
Use the most popular runtime and package type? (Python and zip) [y/N]: y
Would you like to enable X-Ray tracing on the function(s) in your application? [y/N]: y
cd sam-app; sam build
Build Succeeded
sam deploy --guided --profile myprofile --debug
Observed result:
2022-08-10 00:11:16,547 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2022-08-10 00:11:16,547 | Using config file: samconfig.toml, config environment: default
2022-08-10 00:11:16,547 | Expand command line arguments to:
2022-08-10 00:11:16,547 | --guided --template_file=/Users/raychang/test/sam-app/.aws-sam/build/template.yaml --fail_on_empty_changeset --stack_name=sam-app
2022-08-10 00:11:16,715 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is HelloWorldFunction
Configuring SAM deploy
======================
Looking for config file [samconfig.toml] : Not found
Setting default arguments for 'sam deploy'
=========================================
Stack Name [sam-app]:
AWS Region [ap-northeast-1]: eu-west-2
2022-08-10 00:11:26,144 | No Parameters detected in the template
2022-08-10 00:11:26,164 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is HelloWorldFunction
2022-08-10 00:11:26,164 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-08-10 00:11:26,165 | 0 stacks found in the template
#Shows you resources changes to be deployed and require a 'Y' to initiate deploy
Confirm changes before deploy [y/N]: y
#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
#Preserves the state of previously provisioned resources when an operation fails
Disable rollback [y/N]: y
2022-08-10 00:11:28,912 | No Parameters detected in the template
2022-08-10 00:11:28,927 | Sam customer defined id is more priority than other IDs. Customer defined id for resource HelloWorldFunction is HelloWorldFunction
2022-08-10 00:11:28,927 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2022-08-10 00:11:28,927 | 2 resources found in the stack
2022-08-10 00:11:28,927 | Found Serverless function with name='HelloWorldFunction' and CodeUri='HelloWorldFunction'
2022-08-10 00:11:28,927 | --base-dir is not presented, adjusting uri HelloWorldFunction relative to /Users/raychang/test/sam-app/.aws-sam/build/template.yaml
2022-08-10 00:11:28,927 | Detected Inline Swagger definition
2022-08-10 00:11:28,927 | Auth checks done on swagger are not exhaustive!
HelloWorldFunction may not have authorization defined, Is this okay? [y/N]: y
2022-08-10 00:11:31,005 | 2 resources found in the stack
2022-08-10 00:11:31,006 | Found Serverless function with name='HelloWorldFunction' and CodeUri='HelloWorldFunction'
2022-08-10 00:11:31,006 | --base-dir is not presented, adjusting uri HelloWorldFunction relative to /Users/raychang/test/sam-app/.aws-sam/build/template.yaml
2022-08-10 00:11:31,006 | No function or layer definition found with code sign config, skipping
Save arguments to configuration file [Y/n]: y
SAM configuration file [samconfig.toml]:
SAM configuration environment [default]:
Looking for resources needed for deployment:
2022-08-10 00:11:34,237 | Managed S3 stack [aws-sam-cli-managed-default] not found. Creating a new one.
Creating the required resources...
2022-08-10 00:12:25,833 | Failed to create managed resources
Traceback (most recent call last):
File "/usr/local/Cellar/aws-sam-cli/1.53.0/libexec/lib/python3.8/site-packages/samcli/lib/utils/managed_cloudformation_stack.py", line 110, in _create_or_get_stack
stack = _create_stack(
File "/usr/local/Cellar/aws-sam-cli/1.53.0/libexec/lib/python3.8/site-packages/samcli/lib/utils/managed_cloudformation_stack.py", line 183, in _create_stack
stack_waiter.wait(StackName=stack_id, WaiterConfig={"Delay": 15, "MaxAttempts": 60})
File "/usr/local/Cellar/aws-sam-cli/1.53.0/libexec/lib/python3.8/site-packages/botocore/waiter.py", line 55, in wait
Waiter.wait(self, **kwargs)
File "/usr/local/Cellar/aws-sam-cli/1.53.0/libexec/lib/python3.8/site-packages/botocore/waiter.py", line 375, in wait
raise WaiterError(
botocore.exceptions.WaiterError: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression "Stacks[].StackStatus" we matched expected path: "ROLLBACK_FAILED" at least once
2022-08-10 00:12:25,839 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '5ba2cca6-39b8-41e4-96a9-6aefe1e2005d', 'installationId': '570946b8-39db-409d-9310-f7fd3c2ad3df', 'sessionId': '490b6aa0-1755-4526-a985-1958039984eb', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.13', 'samcliVersion': '1.53.0', 'awsProfileProvided': True, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam deploy', 'metricSpecificAttributes': {'projectType': 'CFN'}, 'duration': 69293, 'exitReason': 'ManagedStackError', 'exitCode': 1}}]}
2022-08-10 00:12:26,547 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: Failed to create managed resources: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression "Stacks[].StackStatus" we matched expected path: "ROLLBACK_FAILED" at least once
Expected result:
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: macOS-12.1-x86_64-i386-64bit
sam --version
: 1.53.0- AWS region: eu-west-2
Other things I have tried
- brew install aws-sam-cli again
- delete cloudformation stack and sam deploy -g again
- reset AWS credential with a new token and key
- try using sam installed by either x86 brew and arm brew (I am using M1 mac)
- upgrade aws-cli
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top Results From Across the Web
AWS Sam Hello World Failed - Stack Overflow
It turns out that I cannot succeed with aws s3api list-buckets (Access Denied) I tried to create a new access key and it...
Read more >AWS SAM CLI troubleshooting - AWS Documentation
Troubleshoot error messages when using, installing, and managing the AWS Serverless Application Model Command Line Interface (AWS SAM CLI).
Read more >Installing the AWS SAM CLI - AWS Serverless Application Model
This section describes how to install the AWS SAM CLI on macOS, Windows, ... Tutorial: Deploying a Hello World application – Step-by-step instructions...
Read more >Tutorial: Deploying a Hello World application
AWS SAM CLI error: "Running AWS SAM projects locally requires Docker. Have you got it installed?" When running the sam local start-api command,...
Read more >AWS Serverless Application Model (SAM) Framework - Medium
Developing Lambda applications using AWS SAM. ... In my case the “Hello World Example” called “sam-app”. The project structure looks like ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To clarify: My issue is unrelated to this issue and was resolved. Thanks for the response!
@Wolven531 Your issue does not related to the original authors. The original authors problem was failing to deploy the SAM CLI managed stack and “AdministratorAccess” is referring to IAM permissions.
The issue you seem to be facing is around long paths, which SAM CLI needs enabled on Windows for
sam init
to work. To keep things focused on the original issues, please respond in #4031 or create a new issue with the problem you are still having (if needed).