Where It All Started.

Where It All Started.

Life, Stock Trading, Investments, Business and Startup. Most are programming stuff.

Tag: admin

DevOps Series – Multiple AWS CLI Accounts

Lack of direction, not lack of time, is the problem. We all have twenty-four hour days.

— Zig Ziglar.

As a Dev Ops, I handle multiple project all at once. One problem I encountered is managing multiple AWS accounts for different startups. So how to handle multiple AWS account?

Prerequisites

Before you start doing this, I assume you already know basic command line interface whether its for Windows or from *Nix (Linux, macOS, Unix) derivatives. And also you must have a python interpreter with at least version 3 above.

Multiple, Multiple to the Nth

First, if you haven’t got the AWS CLI (Command Line Interface) install it using the command pip install --upgrade --user awscli. The command will install the awscli package in your local python dist directory.

And now we begin.

You’ll need to generate first your AWS keys and secret access key. Here are the steps.

  • Go to IAM Console
  • Go to Users in the navigation pane and select your IAM username.
  • Select Security credentials and choose Create access key.

Then, after that we will need to configure our AWS using aws configure --profile <your-profile-name>.

aws configure --profile my-profile-name

This command will need some more input from you like your AWS Key, AWS Secret, AWS Account Region and the default output format which would be JSON or TEXT.

If everything is setup properly, we will proceed with running a some sample commands. Also in order for you to use the configured AWS profile, you must always append at the end of your AWS command the --profile <your-profile-name>.

aws configure --profile my-profile-name

Or if you can and will be using it always, export an environment variable AWS_PROFILE containing the profile name like export AWS_PROFILE=<your-profile-name>.

export AWS_PROFILE=my-profile-name

And cheers, you can now use multiple credentials through AWS CLI.

Conclusion

Hi guys a quick tip from me: sometimes, having multiple projects can cause headaches. So as a reminder, always focus and finish one project first before you move to other projects. Stay tuned for more blog updates and series.

Creating A Browse-able Virtual File Archive In Linux

In Linux, there are many ways to create a virtual file archive. A virtual file archive is a storage file which immitates an inode storage device, meaning its similar to what a physical drive can do but contained in a single archive. So how do we create this virtual file archive? What we will be using is the most primitive way to create a virtual file archive using Linux built in tool set.

The secret to happiness is freedom…​ And the secret to freedom is courage.

— Thucydides.

Prerequisites

The tooling that we will be using is already built in Linux. To be transparent what I’m currently using is Arch Linux.

  • dd
  • losetup
  • mount

So what do we do now?

Create the file that will be using as file archive.

dd if=/dev/zero of=gem.bin bs=1024 count=0 seek=1G

Setup a loop block device to handle input/output (emulating physical drives).

losetup /dev/loop0 gem.bin

Create the mountable directory.

mkdir -p /mnt/vfa

Mount the loop block device to the mountable directory.

mount -t ext3 /dev/loop0 /mnt/vfa

So guys, if you like this article hit like and subscribe. Hope you guys, enjoyed this article and as always live life!

Fun Fact

  1. losetup is used to associate loop devices with regular files or block devices, to detach loop devices and to query the status of a loop device. If only the loopdev argument is given, the status of the corresponding loop device is shown.
  2. dd is a command-line utility for Unix and Unix-like operating systems, the primary purpose of which is to convert and copy files.
  3. mount command serves to attach the filesystem found on some device to the big file tree.