•   about 6 years ago

Briefly - what to change in files of the useful example aws-weathergen to make it working for you, also in another region


To avoid errors like following:
AWS::EC2::Instance EC2 The key pair ‘your-key-pair-name’ does not exist
AWS::EC2::Subnet Subnet Value (ap-southeast-2a) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-east-1a, us-east-1b, us-east-1f, us-east-1c, us-east-1d, us-east-1e.
AWS::EC2::Instance EC2 The image id '[ami-30041c53]' does not exist

Create a key-pair.
(Optionally) change the region. If you have not change a region specified in the example code "YOUR_REGION"

Change values in config and stack.json file as suggested below:
"YOUR_REGION" - example: "us-east-1"
"YOUR_GLOBALLY_UNIQUE_BUCKET_NAME" - example: "MyNameIoTLambdaFunctions"
"YOUR_KEY_PAIR_NAME" - example: "nVerginiaEC2Key"
"YOUR_IMAGE_NAME"- example: "ami-4fffc834"

* In the file "aws/cfn/stacks/weatherGen/config":


* In the file "aws/cfn/stacks/weatherGen/stack.json" (note “a” after the region name!):

"Subnet": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "VPC"
"CidrBlock": "",
"AvailabilityZone": "YOUR_REGIONa",

"KeyPairName": {
"Description": "Name of the key pair to use for EC2",
"Type": "String",
"MinLength": "3",
"MaxLength": "32",
"Default": "YOUR_KEY_PAIR_NAME",

Find a virtual machine image (AMI) name (replace “YOUR_REGION” with your region in following links):
Or: https://console.aws.amazon.com/ec2/v2/home?region=YOUR_REGION#LaunchInstanceWizard:
Example (for the region us-east-1):

Specify the AMI with the name found by the link above:
"AMI": {
"Description": "Name of the AMI id to use",
"Type": "String",
"MinLength": "3",
"MaxLength": "32",
"Default": “YOUR_IMAGE_NAME”


  •   •   about 6 years ago

    @Sergey hit it on the head. Please also do not forget that we rely on the AWS CLI tools. These make use of your local configuration (generally in ~/.aws/). If you do want to change regions, you will need to remember to either update your AWS CLI configuration or use the command line switch --region .

    Have fun ! and let us know if we can help further

  •   •   about 6 years ago

    I think need use the command line switch...

Comments are closed.