letslambda icon indicating copy to clipboard operation
letslambda copied to clipboard

"CreateStack" for CloudFormation example fails in validation

Open lenards opened this issue 7 years ago • 5 comments

I have not used CloudFormation much. But in trying to use the instructions in the README.md, I hit a validation error regarding a missing value. It's not clear to me where I need to correct this.

The error text is:

# parameters as bash variables to help clarify user input
$> export UNIQUE_NAME="ajl-2018-letslambda"
$> export UNIQUE_BUCKET_NAME="ajl-new-bucket"
$> aws cloudformation create-stack \
    --stack-name $UNIQUE_NAME \
    --template-body  file://letslambda.json \
    --parameters ParameterKey=Bucket,ParameterValue=$UNIQUE_BUCKET_NAME \
    --capabilities CAPABILITY_IAM

An error occurred (ValidationError) when calling the CreateStack operation: Parameters: [Region] must have values

I'm running this from a clone of the your repository:

$> ls -lha | grep letslambda.json
-rw-r--r--  1 lenards staff 8.4K Feb 13 21:46 letslambda.json

I have not modified letslambda.json.

I have created a letslambda.yml and copied it to the bucket:

$> aws s3 ls $UNIQUE_BUCKET_NAME 
2018-02-14 09:53:32        266 letslambda.yml
2018-02-13 21:32:01   15704129 letslambda.zip

I built letslambda.zip using the ./build.sh script on an Amazon Linux, free tier instance.

I am looking at using this for the DNS ACME challenge. I do not have a need for the Elastic Load Balancer (ELB) so I was not providing elb so that the updates to the elb will not be performed.

lenards avatar Feb 14 '18 17:02 lenards

My letslambda.yml file leaves elb empty with hopes that this code won't be run: https://github.com/kiddouk/letslambda/blob/master/letslambda.py#L556-L557

lenards avatar Feb 14 '18 17:02 lenards

Huh ... I don't know if this really worked, but the create-stack succeeded:

$ aws cloudformation create-stack \
  --stack-name $UNIQUE_NAME \
  --template-body  file://letslambda.json \
  --parameters ParameterKey=Bucket,ParameterValue=$UNIQUE_BUCKET_NAME ParameterKey=Region,ParameterValue=us-west-2 \
  --capabilities CAPABILITY_IAM
{
    "StackId": "arn:aws:cloudformation:us-west-2:$redacted:stack/ajl-2018-letslambda/$uuid-redacted"
}

lenards avatar Feb 14 '18 17:02 lenards

I will put together a pull request for the README instructions.

lenards avatar Feb 14 '18 23:02 lenards

I unfortunately cannot get the build for this to work at the moment. I'll write that up as another issue.

lenards avatar Feb 15 '18 21:02 lenards

I understand a bit more of why Region was needed. I didn't understand anything about CloudFormation, but I realize that Region is defined in the Parameters block:

https://github.com/kiddouk/letslambda/blob/master/letslambda.json#L9-L12

lenards avatar Feb 15 '18 21:02 lenards