Tableau Desktop snippets
How to setup Python TabPy environment on AWS EC2 (free tier)
Instance setup
Following these steps, you will be able to set up a (free) TabPy cloud server to be used for Tableau Desktop installed on your computer/mac or your on-prem server.
- Go to AWS Management Console and log in
- Go to
AWS Services
=>All Services
=>Compute
=>EC2
- In the
Instances (running)
you can see if you already have any Instance - To continue press
Launch Instances
- Press
Launch Instance
=>Launch Instance
(not from template) - Select
Ubuntu Server 20.04 LTS (HVM), SSD Volume Type
-64 bit
- Select
t2.micro
(or select another solution with more power but consider that this may be not included in your free tier)
- Click
Configure Instance Detail
- Select
Enabled
onAuto-assign Public IP
Requests a public IP address from Amazon's public IP address pool, to make your instance reachable from the Internet. In most cases, the public IP address is associated with the instance until it’s stopped or terminated, after which it’s no longer available for you to use. If you require a persistent public IP address that you can associate and disassociate at will, use an Elastic IP address (EIP) instead. You can allocate your own EIP, and associate it to your instance after launch.
- Click on
Add storage
button - Leave default values
- Click
Add Tag
button - Leave empty the
Add tags
screen
- Click on
Configure Security Group
button
Please ask your company security system administrator before selecting the configuration on this screen. Just to make a single basic demo you can choose anywhere from the source IP address but keep in mind that in this way anybody from anywhere could connect to this instance so it is highly recommended that you just use it only for a demo with sample public data.
For this demo, I will go for
my IP source
.
- Fill the custom port for TabPy selecting
Custom TCP Rule
and the default port value9004
.
- Click on
Review and launch
button - In the next step, you will review all of your setting, then click on the
Launch
button.
Key Pair
- In the next screen, you have to select a Key Pair if you already have create one or create a new one
- I will go fo
Create a new key pair
and then type the name of itDemo_TabPy
- Click
Download
to download the.pem
key file - Then click on
Launch Instance
button
- Open
Terminal
in your Mac - Type
cd /Users/myusername/Desktop/Demo_TabPy
to move to the folder where you saved the.pem
file - Type
ls -ltr
if you want to list the directory files and check the presence of the Key file - Set the right permission to the key file using the following instruction
chmod 400 Demo_TabPy.pem
- Go back to your browser and click on the instance name
- Select your instance and hit the
Connect
button from the top menu - Go to the
SSH client
sheet and dopy the connection instruction for terminal (something likessh -i "Demo_TabPy.pem" ubuntu@ec2-55-111-189-240.compute-1.amazonaws.com
- Past it into the terminal and hit
enter
- You should now be connected to the instance
Connect to AWS EC2 instance on Mac
Check if you have Python installed
In your terminal screen just type python3 --version
to check if Python is installed and which version.
Download and install PIP
In your terminal just type In your terminal screen just type and execute At this stage you can install other modules that you are going to use later, for example if you want to use geoClassy package just use the following instruction: To exit the instance you just have to type In your terminal screen just type and execute Open Tableau desktop and go to Go back to your browser and go to the instance summary page: the host name is the value under the Create a calculated field named Please consider closing TabPy and terminate the AWS EC2 instance if you no longer need it after the demo. This will avoid surprise costs and also maintain an open instance and all technical and security issues related. To close TabBy just hit To close the connection to AWS EC2 just type and execute To terminate the AWS EC2 instance you just have to go to the instance summary and hit the You can check if you have running (and maybe costing :-) ) instance from the EC2 home page.curl -O https://bootstrap.pypa.io/get-pip.py
to download PIP, then type to install it.
Install TabPy
python3 -m pip install tabpy
.
Install other modules
python3 -m pip install geoClassy
.
Restart your EC2 instance
exit
and then you can reconnect with the previous connection instruction ssh -i "Demo_TabPy.pem" ubuntu@ec2-44-197-189-240.compute-1.amazonaws.com
Launch TabPy
tabpy
.
Configure Tableau Desktop
Help
=> Manage analytics and extension connections
.Public IPv4 address
label while the port is 9004
.Double quantity
SCRIPT_INT("
list= []
for i in _arg1 :
list.append(i*2)
return list",
SUM([Quantity])
)
Close and terminate your instance
CTRL + C
from terminal.exit
from terminal.Instance state
button and then Terminate instance
.