#cloud-config write_files: - path: /etc/sysctl.d/99-swappiness.conf content: | # Reduce swap usage vm.swappiness=10 vm.vfs_cache_pressure=50 runcmd: # Create 2GB swap file - fallocate -l 2G /swapfile # Set permissions - chmod 600 /swapfile # Make swap - mkswap /swapfile # Enable swap - swapon /swapfile # Add to fstab for persistent mounting - echo '/swapfile none swap sw 0 0' >> /etc/fstab # Verify swap is active - swapon --show - free -h