База знаний
Deploy Swifty to Amazon AWS
Опубликовано Денис Завьялов on 21 November 2018 11:06

How to get Swifty?

There are multiple ways to get Swifty benefits. You can easily deploy Swifty.Lite to your own preferred cloud using our ansible playbooks, you can also get access to one of our partners, or you can deploy Swifty to your own cloud or on-premise infrastructure. Here is the comparison between Swifty and Swifty.lite.

In this guide I will show you how to deploy Swifty to Amazon AWS. We use ansible playbooks here, but  you do not need to be familiar with ansible because our guide already includes all information you need.

Ansible installation

Please use the following guide to install the actual version of ansible. It takes 5 minutes to install it and configure. Please ensure you installed ansible for Python3 because our script is not compatible with Python2.6 version.

For example, here is very good guide how to install Python3 on mac. After that you just need to install ansible:

# pip3 install ansible

Amazon AWS Account and API Credentials

First of all you need to get Amazon AWS account and API credentials. If you already have them please proceed to the next step, if not please use the guide below to create them.

Go to Amazon AWS or create your account using the direct link Create AWS Account. After you get access to the AWS Console please go to Your Account (your account name) -> My Security Credentials -> Access Keys and Create New Access Key. You need to copy and save your Access Key ID and Secret Access Key. You can find more details here.

Now you have API keys to allow ansible automatically creates AWS instances for you. During the setup process ansible will create at least two EC2 instances. By default we use two t2.medium instances and this is the minimal recommended configuration. But you will be able to select any instances you want in ansible config file.

Swifty.Lite deployment

Please get our ansible playbook for AWS from our github repo using:

# git clone https://github.com/swiftycloud/swifty.lite

or download it and unzip it to the folder you want to use.

Create Key Pair

First you need to create key pair for SSH access to AWS instances.

  1. Please fo to AWS Console -> Services -> EC2 -> Key Pairs.
  2. Create Key Pair, name it “swifty”, for example,  and download to your computer.
  3. Copy swifty.pem file to ../swifty-lite/ansible/ folder.

Find your Fedora

Swifty uses Fedora 27 as a base image. The ID of this image is different in every EC2 region. By default, this playbook allows you to deploy swifty to us-east-1 region (N.Virginia) and our image has id “ami-005ca2b3c05cf85e2” here. If you are going to use another region please find your Fedora image id:

  1. Please go to AWS Console -> Services -> EC2 -> Instances -> Launch Instance.
  2. Go to Community AMIs, search for “Fedora-Cloud-Base-27” and copy AMI ID.

Find your VPC ID

AWS EC2 uses concept of Virtual Private Cloud (VPC) to isolate your instances. You need to add your VPC ID to the ansible playbook to allow swifty selects correct cloud:

  1. Please go to AWS Console -> Services -> EC2 -> EC2 Dashboard.
  2. Find and copy Default VPC ID. It looks like “vpc-2766af5c”.

Update ansible configuration

First, you need to create you AWS credential file for your user account if you do not have one.

mkdir ~/.aws/
vim ~/.aws/credentials
[default]
aws_access_key_id=your_key
aws_secret_access_key=your_key

Next, open an ansible configuration file with your favourite text or code editor.

../swifty-lite/ansible/group_vars/all.yml

Please find #ansible section and change ansible_ssh_private_key_file name to ./swifty.pem. Next find #aws section and enter your parameters:

  • ec2_keypair: “swifty” – your key pair name;
  • ec2_instance_type: “t2.medium” – we recommend to use t2.medium for test/dev, but you can use your preferred instance type;
  • ec2_image: “ami-005ca2b3c05cf85e2” – Fedora 27 AMI ID for your region;
  • ec2_vpc_id: “subnet-3a682267” – your VPC ID;
  • ec2_region: “us-east-1” – your AWS Region ID.

Your configuration file should look like this:

# ansible
ansible_ssh_user: fedora
ansible_ssh_private_key_file: ./swifty.pem
# Kubernetes
token: c9f7b8.8d17974y63l7g85s
pod_network_cidr: "10.244.0.0/16"
# passwords
mariadb_root_password: a5d8bfe6979a
mariadb_keystone_password: N9tSc5kgtKqvwRwN
mongodb_admin_password: ew8VKv8Kq79C
mongodb_swygate_password: dt3962zew1b
mongodb_swyadmd_password: 1a84cd9148bG8
mongodb_s3_password: aebik0eichie0eXu
keystone_swyadmin_password: PwE9eMcPAverUJZn
keystone_swyui_password: HEMv3b6GnCGt2XTn
keystone_admin_password: 789qt4htqg5PkbXC
rabbitmq_root_password: 1OqCKIK2G9H
rabbitmq_s3_password: 60baf87b7407
pgr_token: e8yftKPn_GrhFa0d9TMwCt7GG?Ggu:biw:e_bfndvfyC^i-D*=+*euNznmpxE1jq
s3_token: NgsfqX&ruOcjk+CXr@a2yq_M-YAGv7^#-6?E=zw:Rh?FJf_fWVfivHKi1A?m2jDR
s3_secret_key: fd7b1601ae2ff4ccb91b85ea315f2b2e
mw_secpass: f406a11cd8598e80b6180230f116b15b
remote_host_ip: '%'
# aws
ec2_keypair: "swifty"
ec2_instance_type: "t2.medium"
ec2_image: "ami-005ca2b3c05cf85e2"
ec2_vpc_id: "vpc-27667f5c"
ec2_region: "us-east-1"
# system
systemd_dir: /lib/systemd/system
system_env_dir: /etc/sysconfig
network_dir: /etc/kubernetes/network
kubeadmin_config: /etc/kubernetes/admin.conf

Start Swifty deployment

Great! You are ready to deploy your own swifty.cloud! Really. Just run ansible playbook:

# ansible-playbook -vv -i localhost, lite.yml

The output shows the execution plan, describing which actions ansible takes in order to change your infrastructure to match the configuration. If command failed with an error, read the error message and fix the error that occurred. Executing the playbook will take 5-10 minutes.

After successful deployment you will see a message:

"Please go to 34.238.190.49 or ec2-34-238-190-49.compute-1.amazonaws.com to get access to swifty.dashboard. Have a nice day!"

Or you can go to the EC2 console to see the created EC2 instance and get the IP address of your swifty.dashboard. Sign in to EC2 console, go to Services -> EC2 -> Instances and find your swifty machines. Now copy DNS name of your EC2 instance, enter it in your browser and you will find swifty.dashboard:

swifty-dashboard-signup

Congratulations! You are ready to use Swifty!

Don’t know how to start? Please use our Quick Start Guide.

P.S. Want to use Azure, GCP or another cloud? Drop us a line!

 

(0 голос(а))
Эта статья помогла
Эта статья не помогла

Коментарии (0)