Question
CloudFormation Ubuntu RDP using cfn-init Create a CloudFormation YAML template, named ubuntu-rdp.yaml. In it you will convert the User Data script at, https://github.com/drpventura/ec2-ubuntu-init-scripts/blob/master/ubuntu-rdp.sh (Links to
CloudFormation Ubuntu RDP using cfn-init
Create a CloudFormation YAML template, named ubuntu-rdp.yaml. In it you will convert the User Data script at, https://github.com/drpventura/ec2-ubuntu-init-scripts/blob/master/ubuntu-rdp.sh (Links to an external site.)Links to an external site., to be written using the CloudFormation helper scripts, cfn-init (and cfn-signal) to setup the Ubuntu 16.04 instance to be accessible via Windows Remote Desktop Protocol (RDP). NOTE: Do NOT setup cfn-hup (i.e. the extra credit from the homework).
Your User Data section may only contain the following code, all the rest of the configurations must happen in the appropriate config sections.
#!bin/bash -xe apt-get update apt-get -y install python-setuptools easy_install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz /usr/local/bin/cfn-init -v --stack ${AWS::StackId} --resource EC2Instance --region ${AWS::Region} /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource EC2Instance --region ${AWS::Region}
While you must implement the same functionality as the https://github.com/drpventura/ec2-ubuntu-init-scripts/blob/master/ubuntu-rdp.sh User Data script, the following changes are required. You will have a template parameter for the rdp user and the rdp user's password. Your template will then create that user with the specified password.
Other parameters your template must have:
Parameter for the key pair to be used for SSH logins
CIDR block to limit both SSH and RDP logins from, defaulting to USF's CIDR block.
Your template must create a security group for the instance that allows both SSH and RDP traffic only from the designated CIDR block.
The only item you may omit from https://github.com/drpventura/ec2-ubuntu-init-scripts/blob/master/ubuntu-rdp.sh (Links to an external site.)Links to an external site. is the dircolors part.
HINT: you may need to install xrdp as the last package.
The coding from https://github.com/drpventura/ec2-ubuntu-init-scripts/blob/master/ubuntu-rdp.sh is below:
#!/bin/bash | |
# | |
# ubuntu15-rdp | |
# | |
#set this to the username of the rdp user you wish | |
rdpuser="rdpuser" | |
set -e | |
set -x | |
# Skip prompts | |
export DEBIAN_FRONTEND=noninteractive | |
# Set timezone | |
sudo timedatectl set-timezone America/New_York | |
# fix color of directory, which in PuTTy ends up as dark blue on | |
# black background | |
bashrc_append=$(cat <<'EOT' | |
d=.dircolors | |
test -r $d && eval "$(dircolors $d)" | |
EOT | |
) | |
echo "$bashrc_append" >> /home/ubuntu/.bashrc | |
dircolors -p > /home/ubuntu/.dircolors | |
sed -i -e 's/DIR 01;.*/DIR 01;36 # directory/' /home/ubuntu/.dircolors | |
sudo chown ubuntu:ubuntu /home/ubuntu/.dircolors | |
# Create the remote desktop user | |
sudo adduser $rdpuser --disabled-login --gecos "" | |
sudo usermod -aG sudo $rdpuser | |
motdcontents=$(cat < | |
#!/bin/bash | |
echo "" | |
echo "Set the password of $rdpuser using sudo passwd $rdpuser" | |
echo "To fix Tab-completion in XFCE go to Applications->Settings->Window Manager" | |
echo " Go to Keyboard tab" | |
echo " Clear option for Switch window for same application" | |
echo "Delete this reminder using sudo rm /etc/update-motd.d/80-xfce-remind" | |
EOT | |
) | |
echo "$motdcontents" | sudo tee /etc/update-motd.d/80-xfce-remind | |
sudo chmod a+x /etc/update-motd.d/80-xfce-remind | |
# Upgrade | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
# Install packages. | |
sudo apt-get install -y xrdp xfce4 xfce4-terminal | |
# set X to use xfce | |
echo "xfce4-session" | sudo tee /home/$rdpuser/.xsession | |
sudo chown $rdpuser:$rdpuser /home/$rdpuser/.xsession | |
sudo service xrdp restart |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started