# AWS EC2 instance

To deploy UI Bakery to an AWS EC2 instance, follow these steps:

1. Open [AWS Management Console](http://console.aws.amazon.com/) and select Services - EC2 (Virtual Servers in the Cloud).
2. Select `Network & Security` - `Security Groups`. Click `Create security group` button in the top right corner.
3. Input `Bakery` in `Security group name` and `Bakery security group` in `Description.`
4. In block `Inbound rules,` click `Add rule` button. Select `Custom TCP` in the `Type`, input {BakeryPort} (use 3030 by default, you will need to select the same port during UI Bakery installation later) in the `Port range` and select `Anywhere-IPv4` in the `Source.`
5. In block `Inbound rules` click `Add rule` button. Select `SSH` in the `Type` and select `Anywhere-IPv4` in the `Source.`
6. Click `Create security group.`
7. Select `Network & Security` - `Key Pairs`. Click `Create key pairs` button in the top right corner.
8. Input `Bakery` in `Name`. Select `RCA` in `Key pair type`. Select `.pem` in `Private key file format`, if you will be connecting to the VM using OpenSSH, or select `.ppk` in `Private key file format`, if you will be connecting to the VM using Putty.
9. Save the key file to the disk of the local machine.
10. Select `Instances` - `Instance Types`. Select `t2.medium` in the `Instance types` list. Click `Action` - `Launch instance` button in the top right corner.
11. Input 'Bakery' in `Name.`
12. Select an image of `Ubuntu Server 18.04` or higher in the `Application and OS Images (Amazon Machine Image).`
13. Select 'Bakery' in `Key pair (login)` - `Key pair name - required.`
14. Select 'Bakery' in `Network settings` - `Select existing security group` - `Common security groups.`
15. Input 20 GiB in `Configure storage` - `1x.`
16. Click `Launch instance` button in the bottom right corner.
17. After creating and running the virtual machine, connect to it from outside (OpenSSH or Putty) using SSH protocol (use the previously saved key file).
18. Run this command preferably from the `/home` Linux directory to download, install and launch UI Bakery:

    ```bash
    curl -k -L -o install.sh https://raw.githubusercontent.com/uibakery/self-hosted/main/install.sh && bash ./install.sh
    ```
19. Upon request, enter the previously received license code, hosting URL - Public IPv4 address AWS EC2 Instance, and port ({BakeryPort} which you selected in the earlier steps 3030 by default).
20. After the installation is completed and launched, enter the bakery from a browser on your local machine at http\://{Public IPv4 address AWS EC2 Instance}:{BakeryPort}.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uibakery.io/on-premise/install-and-update/installing-on-premise-version/aws-ec2-instance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
