Skip to content

Instantly share code, notes, and snippets.

@fcmendoza
Last active December 23, 2018 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcmendoza/9a97cecd3c0dfee6a4ad01586aa59c42 to your computer and use it in GitHub Desktop.
Save fcmendoza/9a97cecd3c0dfee6a4ad01586aa59c42 to your computer and use it in GitHub Desktop.
Create EC2 instance via Terraform
provider "aws" {
access_key = "YOURACCESSKEYHERE"
secret_key = "YOURSECRETKEYHERE"
region = "us-west-1"
}
resource "aws_instance" "example" {
ami = "ami-00048435fed26a8d1" # Ubuntu 14.04 LTS
instance_type = "t2.micro"
key_name = "my_keypair"
tags = {
Name = "terrabuntu"
}
security_groups = [ "ssh_access", "rdp_access" ]
}
# #####################################################
# vim .bash_profile
# #####################################################
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# Alias definitions.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Custom prompt with colors.
if [ -f ~/.bash_prompt ]; then
. ~/.bash_prompt
fi
. ~/.profile # because bash will not load ~/.profile if ~/.bash_profile exists.
# #####################################################
# vim .bash_aliases
# #####################################################
alias cls='clear'
alias l='ls -pa' # -p shows forward slash for directories
alias ll="ls -FAlh" # -h shows bytes, kilobytes, megabytes, etc. -F is better then -pi
alias ldir="ls -pal | grep ^d" # List all directories in current directory in long list format
alias lct="ls -lcth | cut -c1-96" # the closest to show files ordered by "creation date".
alias grep='grep --color -i'
alias path='echo -e ${PATH//:/\\n}' # Print each PATH entry on a separate line
alias reloadd="source ~/.bash_profile"
# #####################################################
# vim .bash_prompt
# #####################################################
#!/usr/bin/env bash
# Shell prompt based on the Solarized Dark theme.
# Screenshot: http://i.imgur.com/EkEtphC.png
# Heavily inspired by @necolas’s prompt: https://github.com/necolas/dotfiles
# iTerm → Profiles → Text → use 13pt Monaco with 1.1 vertical spacing.
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM='xterm-256color';
fi;
if tput setaf 1 &> /dev/null; then
tput sgr0; # reset colors
bold=$(tput bold);
reset=$(tput sgr0);
# Solarized colors, taken from http://git.io/solarized-colors.
black=$(tput setaf 0);
blue=$(tput setaf 33);
cyan=$(tput setaf 37);
green=$(tput setaf 64);
orange=$(tput setaf 166);
purple=$(tput setaf 125);
red=$(tput setaf 124);
violet=$(tput setaf 61);
white=$(tput setaf 15);
yellow=$(tput setaf 136);
else
bold='';
reset="\e[0m";
black="\e[1;30m";
blue="\e[1;34m";
cyan="\e[1;36m";
green="\e[1;32m";
orange="\e[1;33m";
purple="\e[1;35m";
red="\e[1;31m";
violet="\e[1;35m";
white="\e[1;37m";
yellow="\e[1;33m";
fi;
# Highlight the user name when logged in as root.
if [[ "${USER}" == "root" ]]; then
userStyle="${red}";
else
userStyle="${orange}";
fi;
# Highlight the hostname when connected via SSH.
if [[ "${SSH_TTY}" ]]; then
hostStyle="${bold}${red}";
else
hostStyle="${yellow}";
fi;
# Set the terminal title and prompt.
PS1="\[\033]0;\W\007\]"; # working directory base name
#PS1+="\[${bold}\]\n"; # newline
PS1+="\[${userStyle}\]\u "; # username
#PS1+="\[${white}\] at ";
PS1+="\[${hostStyle}\]\h"; # host
#PS1+="\[${white}\] in ";
PS1+="\[${green}\]\w"; # working directory full path
#PS1+="\n";
PS1+="\[${reset}\] \$ \[${reset}\]"; # `$` (and reset color)
export PS1;
PS2="\[${yellow}\]→ \[${reset}\]";
export PS2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment