GuíasGuides · Nivel 4Level 4

Amazon AWS: cuentas, IAM, una VPC con VPN a la oficina y un servidor que no llega al recurso compartidoAmazon AWS: accounts, IAM, a VPC with VPN to the office and a server that can't reach the file share

AWS Organizations y IAM Identity Center con Entra ID como origen de identidades, la cuenta raíz guardada bajo llave, una VPC privada con VPN de sitio a sitio, un servidor EC2 administrado con Session Manager en lugar de RDP abierto, AWS Backup, alertas de coste con etiquetas y el diagnóstico de un servidor que no ve la oficina.AWS Organizations and IAM Identity Center with Entra ID as the identity source, the root user locked away, a private VPC with a site-to-site VPN, an EC2 server managed with Session Manager instead of open RDP, AWS Backup, cost alerts with tags, and diagnosing a server that can't see the office.

Qué vas a conseguir

Una presencia en AWS que un responsable de sistemas puede defender en una auditoría: cuentas separadas por uso, acceso con las mismas identidades de Entra ID que el resto de la empresa, ninguna puerta RDP o SSH abierta a Internet, copias que se comprueban y un aviso antes de que la factura dé un susto. Y el ticket de conectividad más habitual entre la nube y la oficina, resuelto con la AWS CLI.

Antes de empezar

  • Una cuenta de AWS que será la cuenta de administración de la organización. Sin cargas de trabajo.
  • Permiso de Administrador de aplicaciones (o superior) en Entra ID para crear la aplicación empresarial.
  • La AWS CLI v2 y el plugin de Session Manager instalados en tu equipo.
  • El rango de la oficina (aquí 192.168.10.0/24) y la IP pública del cortafuegos de la sede.
  • Un rango para AWS que no se solape con nada de la empresa (aquí 10.40.0.0/16).

1. Organizaciones, cuentas y la cuenta raíz

  • AWS Organizations con unidades organizativas sencillas: Seguridad (registros y auditoría), Producción y Pruebas. Una cuenta por entorno.
  • Políticas de control de servicios (SCP) mínimas desde el primer día: impedir que una cuenta abandone la organización, limitar las regiones a las que usáis (por ejemplo eu-west-1 y eu-south-2) y proteger el CloudTrail de organización (en la cuenta de Seguridad) para que nadie lo apague.
  • La cuenta raíz no se usa: MFA con llave física, sin claves de acceso, y la dirección de correo es una lista del equipo, no la de una persona. Con la gestión centralizada del acceso raíz de Organizations puedes eliminar las credenciales raíz de las cuentas miembro.

Nadie trabaja con usuarios IAM con claves de larga duración. Un proceso usa un rol (perfil de instancia, OIDC desde el pipeline): las claves olvidadas en un portátil o un repositorio son la causa más común de incidentes en AWS.

2. Acceso con Entra ID: IAM Identity Center

En Entra ID se añade la aplicación de la galería AWS IAM Identity Center (SAML) y en AWS se cambia el origen de identidades. El aprovisionamiento SCIM crea en AWS los usuarios y grupos que asignes a la aplicación, y los desactiva cuando alguien se va.

AWS · IAM Identity Center
IAM Identity CenterConfiguraciónOrigen de identidadesAccionesCambiar el origen de identidades
Origen de identidadesProveedor de identidades externo
Metadatos del IdParchivo XML descargado de la aplicación empresarial de Entra ID
Aprovisionamiento automáticoHabilitado (SCIM) · punto de conexión y token copiados a Entra ID
Conjunto de permisosOpsAdmin (AdministratorAccess) · duración de la sesión 4 h
Conjunto de permisosReadOnly (ViewOnlyAccess) · duración de la sesión 8 h
Asignacióngrupo GRP-AWS-OPS → cuentas Producción y Pruebas → OpsAdmin
Guardar cambios
  • Se asignan grupos, nunca personas sueltas. El alta y la baja se hacen en Entra ID, y el acceso condicional y la MFA de Entra se aplican también a AWS.
  • Desde la terminal: aws configure sso una vez y aws sso login --profile prod-ops cada día. Credenciales temporales, sin claves guardadas.

3. La red: VPC privada y VPN a la oficina

  • VPC 10.40.0.0/16 con subredes privadas en dos zonas de disponibilidad (10.40.1.0/24, 10.40.2.0/24) para los servidores y una pública pequeña solo si hace falta un NAT Gateway para salir a Internet.
  • Puerta de enlace privada virtual (VGW) unida a la VPC, una puerta de enlace de cliente con la IP pública del cortafuegos de la sede y una conexión VPN de sitio a sitio. AWS siempre da dos túneles: configura los dos en el cortafuegos.
  • Rutas estáticas en la conexión VPN (192.168.10.0/24) o BGP si el cortafuegos lo soporta, y propagación de rutas activada en las tablas de rutas de las subredes privadas.
  • Los grupos de seguridad se escriben por origen: el del servidor admite el tráfico de la oficina en los puertos que necesita la aplicación, y nada desde 0.0.0.0/0.

4. Un servidor sin RDP abierto: Session Manager

La instancia EC2 vive en la subred privada, sin IP pública y sin el puerto 3389 en su grupo de seguridad. Se administra con AWS Systems Manager:

  • Perfil de instancia con la política AmazonSSMManagedInstanceCore. El agente de SSM ya viene en las AMI de Windows Server y Amazon Linux.
  • Si la subred no sale a Internet, puntos de conexión de VPC de interfaz para ssm, ssmmessages y ec2messages.
PowerShell · tu equipo
aws sso login --profile prod-opsaws ssm describe-instance-information --profile prod-ops --query "InstanceInformationList[].[InstanceId,ComputerName,PingStatus]" --output texti-0a1b2c3d4e5f60718	srv-app01.contoso.local	Onlineaws ssm start-session --profile prod-ops --target i-0a1b2c3d4e5f60718 --document-name AWS-StartPortForwardingSession --parameters "portNumber=3389,localPortNumber=13389"Starting session with SessionId: javier.ruiz-0f1e2d3c4b5a69788Port 13389 opened for sessionId javier.ruiz-0f1e2d3c4b5a69788.Waiting for connections...# ahora el cliente de Escritorio remoto se conecta a localhost:13389

Sin --document-name, la sesión abre PowerShell o bash en el servidor. Todo queda registrado en CloudTrail.

5. Copias y coste

AWS Backup: un plan con copia diaria (retención 35 días) y mensual (12 meses), una selección de recursos por etiqueta (backup=diario) y copia a un almacén de otra cuenta. Vault Lock en modo cumplimiento impide borrar las copias antes de tiempo, también a un administrador comprometido.

Para el coste, dos piezas (y Cost Anomaly Detection para los picos a mitad de mes):

  • Etiquetas obligatorias (proyecto, entorno, responsable) y activadas como etiquetas de asignación de costes en la consola de Facturación; si no se activan, no aparecen en Cost Explorer.
  • AWS Budgets con avisos sobre el gasto real y el previsto.
AWS · Billing and Cost Management · Presupuestos
Billing and Cost ManagementPresupuestosCrear presupuestoPresupuesto de costes
Nombreprod-mensual · Periodo: mensual · Importe: el aprobado para el año entre doce
Ámbitocuenta Producción · filtro de etiqueta entorno=prod
Umbral de alerta 180 % del gasto real → grupo de correo del equipo y canal SNS
Umbral de alerta 2100 % del gasto previsto → mismo destino
Crear presupuesto

6. El ticket: "el servidor no llega al recurso compartido de la oficina"

srv-app01 necesita leer \\srv-fs01\intercambio en la sede y falla. Se recorre el camino en orden: túnel, rutas, grupo de seguridad, y el otro extremo.

AWS CLI · diagnóstico
aws ec2 describe-vpn-connections --vpn-connection-ids vpn-0c1d2e3f4a5b6c7d8 --query "VpnConnections[0].VgwTelemetry[].[OutsideIpAddress,Status,LastStatusChange]" --output text198.51.100.21	UP	2026-10-27T22:14:05+00:00198.51.100.22	DOWN	2026-10-27T22:13:58+00:00aws ec2 describe-route-tables --filters Name=association.subnet-id,Values=subnet-0a9b8c7d6e5f40312 --query "RouteTables[0].Routes[].[DestinationCidrBlock,GatewayId,NatGatewayId,State]" --output text10.40.0.0/16	local	None	active0.0.0.0/0	None	nat-0f9e8d7c6b5a40321	activeaws ec2 describe-route-tables --filters Name=association.subnet-id,Values=subnet-0a9b8c7d6e5f40312 --query "RouteTables[0].[RouteTableId,PropagatingVgws]" --output textrtb-0d4c3b2a1f0e9d8c7# no hay ruta a 192.168.10.0/24 y la tabla no propaga desde la VGWaws ec2 enable-vgw-route-propagation --route-table-id rtb-0d4c3b2a1f0e9d8c7 --gateway-id vgw-0b1a2c3d4e5f60789
  • Túneles: con uno arriba hay servicio; el otro caído se corrige en el cortafuegos, pero no es la causa.
  • Rutas: aquí estaba el problema. La tabla se recreó la semana anterior y nadie volvió a activar la propagación, así que el tráfico hacia la oficina salía por el NAT. Tras activarla aparece 192.168.10.0/24 con destino la VGW.
  • Grupo de seguridad: la salida por defecto lo permite todo; si se restringió, necesita TCP 445 hacia 192.168.10.0/24.
  • El otro extremo: el cortafuegos de la sede tiene que conocer 10.40.0.0/16 por el túnel y permitir SMB desde ahí. Desde una sesión de SSM, Test-NetConnection srv-fs01 -Port 445 lo confirma de punta a punta.

7. Lo que revisas cada mes

  • Hallazgos de Security Hub e IAM Access Analyzer: accesos externos, roles sin uso, claves de acceso que no deberían existir.
  • Trabajos de AWS Backup fallidos y una restauración de prueba al trimestre.
  • Estado de los dos túneles VPN y el informe de Cost Explorer agrupado por la etiqueta proyecto, con los recursos sin etiquetar.

Siguientes pasos

  • La guía de Terraform para que cuentas, VPC y servidores salgan de un repositorio revisado.
  • La guía de Backup y DR/BCP para encajar AWS Backup en el plan de continuidad de la empresa.
  • La guía de Fortinet FortiGate para el lado de la oficina de la VPN.
  • La guía de Kubernetes cuando las aplicaciones pasen de un servidor a contenedores (EKS).

¿Falta algo o en tu entorno es distinto? Escríbeme y lo corrijo.

What you'll get

An AWS presence that an IT lead can defend in an audit: accounts separated by purpose, access with the same Entra ID identities as the rest of the company, no RDP or SSH door open to the Internet, backups that are tested and a warning before the bill becomes a shock. And the most common connectivity ticket between the cloud and the office, solved with the AWS CLI.

Before you start

  • An AWS account that will be the organisation's management account. No workloads.
  • The Application Administrator role (or higher) in Entra ID to create the enterprise application.
  • AWS CLI v2 and the Session Manager plugin installed on your machine.
  • The office range (192.168.10.0/24 here) and the public IP of the site firewall.
  • A range for AWS that doesn't overlap with anything in the company (10.40.0.0/16 here).

1. Organisations, accounts and the root user

  • AWS Organizations with simple organisational units: Security (logs and audit), Production and Test. One account per environment.
  • Minimal service control policies (SCPs) from day one: stop an account leaving the organisation, limit regions to the ones you use (for example eu-west-1 and eu-south-2) and protect the organisation CloudTrail trail (in the Security account) so nobody turns it off.
  • The root user is not used: MFA with a hardware key, no access keys, and its email address is a team list, not one person's. With Organizations' centralised root access management you can remove root credentials from member accounts.

Nobody works with IAM users holding long-lived keys. A process uses a role (instance profile, OIDC from the pipeline): keys forgotten on a laptop or in a repository are the most common cause of AWS incidents.

2. Access with Entra ID: IAM Identity Center

In Entra ID you add the gallery application AWS IAM Identity Center (SAML) and in AWS you change the identity source. SCIM provisioning creates in AWS the users and groups you assign to the application, and disables them when someone leaves.

AWS · IAM Identity Center
IAM Identity CenterSettingsIdentity sourceActionsChange identity source
Identity sourceExternal identity provider
IdP metadataXML file downloaded from the Entra ID enterprise application
Automatic provisioningEnabled (SCIM) · endpoint and token copied into Entra ID
Permission setOpsAdmin (AdministratorAccess) · session duration 4 h
Permission setReadOnly (ViewOnlyAccess) · session duration 8 h
Assignmentgroup GRP-AWS-OPS → Production and Test accounts → OpsAdmin
Save changes
  • You assign groups, never individual people. Joiners and leavers are handled in Entra ID, and Entra's Conditional Access and MFA apply to AWS too.
  • From the terminal: aws configure sso once and aws sso login --profile prod-ops each day. Temporary credentials, no stored keys.

3. The network: private VPC and VPN to the office

  • VPC 10.40.0.0/16 with private subnets in two availability zones (10.40.1.0/24, 10.40.2.0/24) for the servers, and a small public one only if a NAT gateway is needed to reach the Internet.
  • A virtual private gateway (VGW) attached to the VPC, a customer gateway with the public IP of the site firewall and a site-to-site VPN connection. AWS always gives you two tunnels: configure both on the firewall.
  • Static routes on the VPN connection (192.168.10.0/24) or BGP if the firewall supports it, and route propagation enabled on the private subnets' route tables.
  • Security groups are written by source: the server's one allows traffic from the office on the ports the application needs, and nothing from 0.0.0.0/0.

4. A server without open RDP: Session Manager

The EC2 instance lives in the private subnet, with no public IP and no port 3389 in its security group. It is managed with AWS Systems Manager:

  • An instance profile with the AmazonSSMManagedInstanceCore policy. The SSM agent already ships in the Windows Server and Amazon Linux AMIs.
  • If the subnet has no Internet egress, interface VPC endpoints for ssm, ssmmessages and ec2messages.
PowerShell · your machine
aws sso login --profile prod-opsaws ssm describe-instance-information --profile prod-ops --query "InstanceInformationList[].[InstanceId,ComputerName,PingStatus]" --output texti-0a1b2c3d4e5f60718	srv-app01.contoso.local	Onlineaws ssm start-session --profile prod-ops --target i-0a1b2c3d4e5f60718 --document-name AWS-StartPortForwardingSession --parameters "portNumber=3389,localPortNumber=13389"Starting session with SessionId: javier.ruiz-0f1e2d3c4b5a69788Port 13389 opened for sessionId javier.ruiz-0f1e2d3c4b5a69788.Waiting for connections...# now the Remote Desktop client connects to localhost:13389

Without --document-name, the session opens PowerShell or bash on the server. Everything is logged in CloudTrail.

5. Backups and cost

AWS Backup: a plan with daily backups (35-day retention) and monthly ones (12 months), a resource selection by tag (backup=daily) and a copy to a vault in another account. Vault Lock in compliance mode prevents deleting backups early, even by a compromised administrator.

For cost, two pieces (and Cost Anomaly Detection for mid-month spikes):

  • Mandatory tags (project, environment, owner) activated as cost allocation tags in the Billing console; if they aren't activated, they don't show up in Cost Explorer.
  • AWS Budgets with alerts on actual and forecast spend.
AWS · Billing and Cost Management · Budgets
Billing and Cost ManagementBudgetsCreate budgetCost budget
Nameprod-monthly · Period: monthly · Amount: the yearly approved figure divided by twelve
ScopeProduction account · tag filter environment=prod
Alert threshold 180 % of actual spend → team mailing list and SNS topic
Alert threshold 2100 % of forecast spend → same target
Create budget

6. The ticket: "the server can't reach the office file share"

srv-app01 needs to read \\srv-fs01\exchange at the site and fails. Walk the path in order: tunnel, routes, security group, and the other end.

AWS CLI · diagnosis
aws ec2 describe-vpn-connections --vpn-connection-ids vpn-0c1d2e3f4a5b6c7d8 --query "VpnConnections[0].VgwTelemetry[].[OutsideIpAddress,Status,LastStatusChange]" --output text198.51.100.21	UP	2026-10-27T22:14:05+00:00198.51.100.22	DOWN	2026-10-27T22:13:58+00:00aws ec2 describe-route-tables --filters Name=association.subnet-id,Values=subnet-0a9b8c7d6e5f40312 --query "RouteTables[0].Routes[].[DestinationCidrBlock,GatewayId,NatGatewayId,State]" --output text10.40.0.0/16	local	None	active0.0.0.0/0	None	nat-0f9e8d7c6b5a40321	activeaws ec2 describe-route-tables --filters Name=association.subnet-id,Values=subnet-0a9b8c7d6e5f40312 --query "RouteTables[0].[RouteTableId,PropagatingVgws]" --output textrtb-0d4c3b2a1f0e9d8c7# no route to 192.168.10.0/24 and the table doesn't propagate from the VGWaws ec2 enable-vgw-route-propagation --route-table-id rtb-0d4c3b2a1f0e9d8c7 --gateway-id vgw-0b1a2c3d4e5f60789
  • Tunnels: with one up there is service; the other one down gets fixed on the firewall, but it isn't the cause.
  • Routes: this was the problem. The table was recreated the week before and nobody re-enabled propagation, so traffic to the office went out through the NAT. Once enabled, 192.168.10.0/24 appears with the VGW as target.
  • Security group: default egress allows everything; if it was restricted, it needs TCP 445 to 192.168.10.0/24.
  • The other end: the site firewall has to know 10.40.0.0/16 through the tunnel and allow SMB from it. From an SSM session, Test-NetConnection srv-fs01 -Port 445 confirms it end to end.

7. What you review each month

  • Security Hub and IAM Access Analyzer findings: external access, unused roles, access keys that shouldn't exist.
  • Failed AWS Backup jobs, and a test restore every quarter.
  • Status of both VPN tunnels, and the Cost Explorer report grouped by the project tag, with the untagged resources.

Next steps

  • The Terraform guide so that accounts, VPCs and servers come out of a reviewed repository.
  • The Backup y DR/BCP guide to fit AWS Backup into the company's continuity plan.
  • The Fortinet FortiGate guide for the office side of the VPN.
  • The Kubernetes guide when applications move from a server to containers (EKS).

Is something missing, or different in your environment? Get in touch and I'll fix it.

Tech Career Lab · newsletter

¿Te ha servido? Cada dos semanas envío una idea práctica para perfiles IT: LinkedIn, proyectos, networking y procesos de selección.Found this useful? Every two weeks I send one practical idea for IT professionals: LinkedIn, projects, networking and hiring processes.

Apúntate y llévate las 33 ideasSign up and get the 33 ideas →