'Surpress opening of text editor when using aws lambda update-function-code

When running

aws lambda update-function-code --function-name my-function --zip-file fileb://my-zip-file.zip"

it opens an editor with the details upon completion. How can I prevent this, or how can I add a command to automatically close it? Can I pipe :q into my command or something similar?



Solution 1:[1]

Feature you are looking for is called AWS CLI pager and there is several ways how to suppres it

Disable for single command

Use --no-cli-pager option

aws lambda update-function-code --function-name my-function --zip-file fileb://my-zip-file.zip --no-cli-pager

Disable permanently

Using environment variable

First option to disable aws cli pager permanently is to set AWS_PAGER to nothing in shell initialization file (.bashrc, .zshrc, ...)

export AWS_PAGER=""

Using AWS CLI config

Second option is to use CLI configuration. Then you can have different settings for different AWS_PROFILE

aws configure set cli_pager ""
Config example
[default]
...
cli_pager =

[admin]
...
cli_pager = less

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1