Implantação em uma VM na nuvem
Implante sua aplicação conteinerizada com Docker em uma instância de máquina virtual de um provedor de nuvem escolhido.
Implantação em uma VM na nuvem é uma aula grátis de AI Powered SaaS: Stripe + Auth + Billing + Deploy no CoddyKit. Esta é a aula 3 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de AI Powered SaaS: Stripe + Auth + Billing + Deploy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de AI Powered SaaS: Stripe + Auth + Billing + Deploy inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
Deploying to the Cloud
You've containerized your app with Docker. Now, it's time to put it online! This lesson covers deploying your Dockerized application to a cloud Virtual Machine (VM).
A VM acts like a remote computer where your app can run 24/7, accessible to users worldwide.
What's a Virtual Machine?
A Virtual Machine (VM) is a software-based computer that runs on a physical server in a cloud data center. It has its own CPU, memory, storage, and network interface, just like a physical machine.
- Isolation: Each VM is isolated from others.
- Flexibility: You choose the operating system (OS) and resources.
- Persistence: Your app keeps running even if you disconnect.
Choosing Cloud Provider & OS
Major cloud providers offer VMs:
- AWS EC2: Amazon Elastic Compute Cloud
- GCP Compute Engine: Google Cloud Platform
- Azure Virtual Machines: Microsoft Azure
For your Dockerized app, a Linux OS (like Ubuntu or CentOS) is typically the best and most cost-effective choice.
Launching Your Cloud VM
Launching a VM involves a few key steps:
- Instance Type: Select CPU/RAM based on app needs.
- Region: Choose a geographical location close to your users.
- Key Pair: Create a secure SSH key for access.
- Security Group/Firewall: Define network rules (e.g., allow SSH, HTTP/S).
These are configured through your cloud provider's console or API.
Connecting via SSH
Once your VM is launched, you'll connect to it using SSH (Secure Shell). This encrypted protocol allows you to execute commands remotely and securely.
You'll use the private key from your key pair to authenticate.
ssh -i /path/to/your-key.pem ubuntu@your-vm-ipInstalling Docker Engine
Your cloud VM starts fresh. The first step is to install Docker Engine, which allows your VM to run Docker containers.
For Ubuntu, you'd update packages, then install Docker. This makes your VM a Docker host!
sudo apt update
sudo apt install docker.io -y
sudo systemctl start docker
sudo systemctl enable dockerPulling Your App's Image
With Docker installed, you need your application's Docker image on the VM. If you pushed your image to a registry like Docker Hub or a private cloud registry, you can simply pull it.
Replace your-username/your-app:latest with your actual image name.
docker pull your-username/your-app:latestLaunching Your Container
Now, run your container! The -p flag maps a port on your VM (e.g., 80) to a port inside your container (e.g., 3000, where your app listens).
The -d flag runs it in 'detached' mode, so it runs in the background.
docker run -d -p 80:3000 your-username/your-app:latestOpening Ports (Firewall)
Even if your container is running, users can't reach it unless you open the necessary ports on your VM's firewall (often called 'security groups' in cloud providers).
You'll need to allow inbound traffic on port 80 (for HTTP) and potentially 443 (for HTTPS) from anywhere (0.0.0.0/0).
Checking Your Live App
After running your container and configuring the firewall, you can verify your deployment.
- SSH: Use
docker psto see running containers. - Browser: Navigate to your VM's public IP address or domain name in a web browser.
If you see your app, congratulations!
docker psDeployment Check
You've deployed your Dockerized app to a cloud VM. What's the primary tool used to securely connect and manage your remote VM?
Recap: VM Deployment
In this lesson, you learned how to deploy your Dockerized application to a cloud Virtual Machine. We covered selecting a provider, launching an instance, connecting via SSH, installing Docker, pulling and running your image, and configuring network access.
This is a foundational step for making your SaaS application publicly available!
Perguntas Frequentes
A aula “Implantação em uma VM na nuvem” é grátis?
Sim — o texto completo de “Implantação em uma VM na nuvem” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de AI Powered SaaS: Stripe + Auth + Billing + Deploy, atualize para CoddyKit PRO. O curso de AI Powered SaaS: Stripe + Auth + Billing + Deploy inclui 4 aulas no total.
O que vou aprender em “Implantação em uma VM na nuvem”?
Implante sua aplicação conteinerizada com Docker em uma instância de máquina virtual de um provedor de nuvem escolhido. Você pratica AI Powered SaaS: Stripe + Auth + Billing + Deploy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar AI Powered SaaS: Stripe + Auth + Billing + Deploy?
Nenhuma experiência prévia é necessária. AI Powered SaaS: Stripe + Auth + Billing + Deploy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 3 de 4.
Quanto tempo leva a aula “Implantação em uma VM na nuvem”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de AI Powered SaaS: Stripe + Auth + Billing + Deploy?
Sim. Cada aula de AI Powered SaaS: Stripe + Auth + Billing + Deploy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- Conteinerização da sua aplicação
- Introdução aos provedores de nuvem
- Implantação em uma VM na nuvem
- Aplicações com Vários Contêineres usando Docker Compose