Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Terraform & Packer for Kali Linux EC2 instance


Create a Kali Linux EC2 instance by utilizing Packer by using the official Kali Linux AMI and and apt-get dist-upgrade to be up-to-date with the Kali Linux Rolling Release.

If you don't want to run Packer, Terraform uses the default Kali Linux AMI ami-10e00b6d based on Kali Linux 2018.3a. Please keep in mind that this is outdated and you have to update yourself to the current Rolling Release (apt-get update && apt-get dist-upgrade).


Before running the packer build, you have to accept the terms and conditions of the Kali Linux AMI (this is an requirement of the AWS Marketplace):

or (this will shown to you when you run this Terraform before accepting the terms):

  • Click on "Continue to Subscribe"
  • Then "Accept Terms"

and no, this Kali AMI has no costs (it's FREE!) - the price shown to you on the AWS Marketplace is for the calculated EC2 instance type usage.


Clone the repository

git clone (when using SSH)

Packer: Build your custom AMI

packer build packer.json

Note down the AMI ID at the end:

==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs: AMIs were created:
eu-central-1: ami-10e00b6d

Terraform: Customize your AWS EC2 instance configuration

By default, Terraform uses this configuration if you don't create an AMI with Packer and leave everything as is:

  • Creates a new VPC with CIDR range
  • Create new Subnet with CIDR range
  • Uses IPv4 & IPv6
  • Creates new AWS Key pair from your ~/.ssh/ public key
  • Creates EC2 instance with instance type t2.medium (2 vCPU, 4.0 GB Memory)
  • EC2 instance uses default Kali Linux AMI ami-10e00b6d (based on Kali Linux 2018.3a so you have to update yourself)


If you want to completely build your own Kali Linux, you can use the official kali-cloud-build tools.


Name Description Type Default Required
packer_ami Packer AMI ID to use for EC2 instance (NOTE: run packer buidl packer.json and use the generated AMI ID here) string "ami-10e00b6d" yes
aws_profile AWS cli profile string "default" no
aws_region AWS region string "eu-central-1" no
create_vpc Create new VPC (e.g. true or false) - Please set to false when setting an existing vpc_id above - NOTE: no doublequotes around the true or false string "true" no
ec2_instance_type EC2 instance type (e.g. t2.medium or t2.small) string "t2.medium" no
public_key_path Path to your SSH public key (e.g. ~/.ssh/ string "~/.ssh/" no
ssh_key_pair_name AWS Key pair name of existing SSH Key pair on AWS (e.g. my-key) string "" no
subnet_cidr_block The CIDR block to use for the new subnet (e.g. or - Must be in range of VPC CIDR string "" no
subnet_id Use an existting Subnet in an existing VPC (please set create_vpc to false when using this) string "" no
use_ipv4only Use IPv4 only (e.g. true or false) - Please set use_ipv6 to false when enabling this - NOTE: no doublequotes around the true or false string "false" no
use_ipv6 Use IPv4 AND IPv6 (e.g. true or false) - NOTE: no doublequotes around the true or false string "true" no
vpc_cidr VPC CIDR block for new AWS VPC (e.g. or - The Subnet CIDR must match this VPC CIDR string "" no
vpc_id Use an existing VPC (please set create_vpc to false when using this) string "" no


Name Description
public_ip Public IPv4 address of Kali EC2 instance


No releases published


No packages published