1. Switch the console to the target region
Before creating a stack, set the CloudFormation console to the region where you want resources deployed — here, EU (Ireland) (eu-west-1).
2. Create the stack from an uploaded template
- Choose Create stack → Choose an existing template → Upload a template file.
- Upload your CloudFormation template (for example,
ec2-instance.yaml). CloudFormation uploads the template to an S3 bucket in the selected region to use during stack creation.

3. Specify stack details and parameters
Provide a stack name (for example,DemoStackEU) and choose parameter values such as instance type and subnet (we use the default VPC subnet in Ireland in this demo).

4. CloudFormation creates the resources in the selected region
While the stack is being created you can already observe resources being provisioned — for example, the security group created by the template appears in the EC2 console.

5. Template technique: selecting AMIs per region
This template demonstrates how to select the correct AMI per region using a Mappings section and the AWS::Region pseudo parameter. The instance resource uses FindInMap to pick the AMI that corresponds to the region where the stack is created. The template also defines a security group resource namedMySecurityGroup, which the instance references.
- CloudFormation evaluates the pseudo parameter
AWS::Regionat stack creation time to detect the region (example:eu-west-1). !FindInMap [RegionMap, !Ref "AWS::Region", AMI]looks up the AMI that corresponds to that region.- Instance properties (InstanceType, ImageId, SubnetId, SecurityGroupIds) are resolved and the EC2 instance is launched in the selected region.
The pseudo parameter AWS::Region resolves to the region where the stack is created. Use a RegionMap with Fn::FindInMap to select region-specific values (such as AMI IDs) without maintaining multiple templates.
6. Verify the instance and test the web server
After the instance is running, view its details in the EC2 console to confirm the VPC, AMI ID, and public IP. The instance name in this demo is SimpleWebServer.

7. Clean up — delete the stack and remove temporary S3 templates
To remove the resources created by the stack, delete the CloudFormation stack. Deleting the stack removes the EC2 instance, security group, and all resources the template created.

Be careful when emptying and deleting S3 buckets. Ensure the bucket only contains temporary CloudFormation templates and no important data before permanently deleting objects.

Quick reference — recommended steps
| Step | Action | Notes |
|---|---|---|
| 1 | Switch CloudFormation console to target region | Example: eu-west-1 (Ireland) |
| 2 | Create stack → Upload template | CloudFormation uploads the template to a regional S3 bucket |
| 3 | Specify stack name and parameters | Choose instance type and subnet in the region |
| 4 | Verify resources in EC2 and other consoles | Security groups, instances, public IPs |
| 5 | Test the application | Visit instance public IP (HTTP) |
| 6 | Delete stack and remove S3 templates | Empty and delete temporary S3 bucket if not needed |
Summary
- Always switch the CloudFormation console to the target region before creating a stack.
- Use a RegionMap mapping plus the
AWS::Regionpseudo parameter andFn::FindInMapto select region-specific values (like AMI IDs) without modifying templates per region. - Deleting a CloudFormation stack removes the resources it created in that region.
- Clean up any temporary S3 template buckets created during stack creation unless you need to preserve them.