Deploying AWS Lambda "Hello World" using sam init, sam build sam deploy defaults fails with Failed to create changeset for sam-app

722 Views Asked by At

I have followed the simplest route to create a basic AWS lambda function on my PC - but when I try to deploy it it fails with an obscure message.

Error: Failed to create changeset for the stack: sam-app, An error occurred (InternalFailure) when calling the CreateChangeSet operation (reached max retries: 4): Unknown

I believe I have provided all the required permissions :

  • AmazonS3FullAccess
  • AWSCodeDeployFullAccess
  • AWSLambdaRole
  • AWSCloudFormationFullAccess
  • AWSLambda_FullAccess

and additionally :

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "iam:DetachRolePolicy",
                "iam:ListAttachedRolePolicies",
                "iam:CreateRole"
            ],
            "Resource": "*"
        }
    ]
}

My terminal session commands & responses are :

c:\My Projects\Nuzum-AWS\sam-app>sam deploy --guided --template-file .aws-sam\build\template.yaml

Configuring SAM deploy

    Looking for config file [samconfig.toml] :  Not found

    Setting default arguments for 'sam deploy'
    =========================================
    Stack Name [sam-app]:
    AWS Region [eu-west-1]:
    #Shows you resources changes to be deployed and require a 'Y' to initiate deploy
    Confirm changes before deploy [y/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]:
    #Preserves the state of previously provisioned resources when an operation fails
    Disable rollback [y/N]:
    HelloWorldFunction may not have authorization defined, Is this okay? [y/N]: y
    Save arguments to configuration file [Y/n]:
    SAM configuration file [samconfig.toml]:
    SAM configuration environment [default]:

    Looking for resources needed for deployment:
     Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-dee0ker00dts
     A different default S3 bucket can be set in samconfig.toml

    Saved arguments to config file
    Running 'sam deploy' for future deployments will use the parameters saved above.
    The above parameters can be changed by modifying samconfig.toml
    Learn more about samconfig.toml syntax at
    https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html

Uploading to sam-app/7b33e513850748d9482c8e504aacefb2 533 / 533 (100.00%)

    Deploying with following values
    ===============================
    Stack name                   : sam-app
    Region                       : eu-west-1
    Confirm changeset            : False
    Disable rollback             : False
    Deployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-dee0ker00dts
    Capabilities                 : ["CAPABILITY_IAM"]
    Parameter overrides          : {}
    Signing Profiles             : {}

Initiating deployment

Uploading to sam-app/4e272b888be3f30dedd7ac0cf77b1925.template 1361 / 1361 (100.00%) Error: Failed to create changeset for the stack: sam-app, An error occurred (InternalFailure) when calling the CreateChangeSet operation (reached max retries: 4): Unknown

1

There are 1 best solutions below

0
AMAL On

You gave confirm change set value as false. you have to give that as true. Can you try giving these values while deploying?

  1. Confirm changes before deploy [y/N]:y.
  2. Allow SAM CLI IAM role creation [Y/n]:y
  3. Disable rollback [y/N]:n
  4. Save arguments to configuration file [Y/n]:y