Query and Stop AWS EC2 Instances by Tag

Query a list of running AWS EC2 instances with the tag key-value pair status: decom using Steampipe and then stop them.


Download and install Flowpipe ( Or use Brew:

brew tap turbot/tap
brew install flowpipe


git clone
cd public_cloud/query_and_stop_aws_ec2_instance

Install mod dependencies:

flowpipe mod install


By default, the following environment variables will be used for authentication:


You can also create credential resources in configuration files:

vi creds.fpc
credential "aws" "aws_profile" {
profile = "my-profile"
credential "aws" "aws_access_key_pair" {
access_key = "AKIA..."
secret_key = "dP+C+J..."
credential "aws" "aws_session_token" {
access_key = "AKIA..."
secret_key = "dP+C+J..."
session_token = "AQoDX..."

For more information on credentials in Flowpipe, please see Managing Credentials.


Run the pipeline and specify the aws_region pipeline arguments:

flowpipe pipeline run query_and_stop_aws_ec2_instance --arg aws_region=us-east-1


To avoid entering variable values when running the pipeline or starting the server, you can set variable values:

cp flowpipe.fpvars.example flowpipe.fpvars
vi flowpipe.fpvars
# Optional
# aws_cred = "non_default_cred"

Open Source & Contributing

This repository is published under the Apache 2.0 license. Please see our code of conduct. We look forward to collaborating with you!

Flowpipe is a product produced from this open source software, exclusively by Turbot HQ, Inc. It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our Open Source FAQ.

Get Involved

Join #flowpipe on Slack →

Want to help but not sure where to start? Pick up one of the help wanted issues: