DEV Community

Cover image for Shorten the CLI command for AWS Amplify
Sean Boult for AWS

Posted on Originally published at builder.aws.com AI-assisted

Shorten the CLI command for AWS Amplify

As a developer, I like really short commands. Even though we have agents, I still type and run CLI commands a lot.

We just launched the latest AWS Amplify and it's awesome! The latest Amplify is part of the AWS CLI, with the command aws amplifygen3. The one thing I wanted was a shorter version of this command, something like:

amp deploy
amp rollback
# etc
Enter fullscreen mode Exit fullscreen mode

Here's how I did it for my zsh shell.

Add this to your ~/.zshrc:

amp() {
    case "${1-}" in
    dev)
        shift
        set -- local run "$@"
        ;;
    status | stop)
        set -- local "$@"
        ;;
    tail)
        shift
        set -- local logs --follow "$@"
        ;;
    migrate)
        shift
        set -- local migration apply "$@"
        ;;
    esac
    aws amplifygen3 "$@"
}
Enter fullscreen mode Exit fullscreen mode

I restarted my shell and that was it! 🎉

Terminal running amp commands

Now I can run commands a bit more easily when I'm doing local development.

Let me know what you think, and send any feedback you have on the latest AWS Amplify.


As always, happy shipping 🫡!

Follow AWS for more articles like this.

Follow me for all things tech.

Top comments (1)

Collapse
 
athenaindev profile image
Athena Wemmert AWS •

wait now this is goated