Code Monkey home page Code Monkey logo

aws-simple-ec2-cli's Issues

Creating Multiple SSH Security Groups

Describe the bug
A concise description of what the bug is.
When given options to create security groups in the simple-ec2 CLI tool, the user is given the option to create a new security group that enables SSH. However, if they have already created a security group that enables SSH simple-ec2 will return an error as the security groups GroupName field is hardcoded, instead of having a unique value.

Steps to reproduce
A step-by-step description on how to reproduce the problem.

  1. Use interactive mode on simple-ec2.
  2. In the security group selection step, choose the option to create a new security group that enables SSH.
  3. If this was the first time selecting the "create a new security group that enables SSH" option, then repeat steps 1 and 2.

Expected outcome
A concise description of what you expected to happen.
One of the following:

  1. Multiple SSH security groups can be created
  2. Only one SSH security group can be created, and the option to create more is removed

Application Logs
The log output when experiencing the issue.
Creating new security group for SSH failed: InvalidGroup.Duplicate: The security group 'simple-ec2 SSH' already exists for VPC 'vpc-07a5eb4bd9c8f9fcd' status code: 400, request id: 92971c58-1945-4afb-b92c-3347de5c175a

Environment
Simple-EC2 using Mac terminal

  • App Version:
  • OS/Arch:

Invalid interactive input proceeds with defaults

Describe the bug
The user is allowed to enter invalid input and proceed (unknowingly until end summary) with defaults when using simple-ec2 in interactive mode.

Steps to reproduce

  • Start simple-ec2 launch in interactive mode
  • When asked to provide an input, enter invalid input
  • Hit enter until pre-launch summary
  • Note the default value where you entered invalid input

Expected outcome
After entering invalid input, the app should re-prompt:

Instance Type (eg. m5.xlarge, c5.xlarge) [t1.micro]:  meep
Input invalid. Please try again.
Instance Type (eg. m5.xlarge, c5.xlarge) [t1.micro]:

If user hits enter, it will proceed with default as expected OR they enter valid input OR enter invalid input and repeat loop.

Application Logs


+--------+-----------------------------------------------+----------------+
| OPTION |                LAUNCH TEMPLATE                | LATEST VERSION |
+--------+-----------------------------------------------+----------------+
| 1.     | Test_w_spot(lt-0df2e6bd72274f663)             | 1              |
+--------+-----------------------------------------------+----------------+
| 2.     | simple-lt-used-by-fleet(lt-002cf32cc66212864) | 1              |
+--------+-----------------------------------------------+----------------+
| 3.     | test-no-spot(lt-0abdca811f31d268f)            | 1              |
+--------+-----------------------------------------------+----------------+
| 4.     | Do not use launch template                    |
+--------+-----------------------------------------------+----------------+
Launch Template [Do not use launch template]:

1. I will enter the instance type
2. I need advice given vCPUs and memory
Instance Select Method [t1.micro]:  1

Instance Type (eg. m5.xlarge, c5.xlarge) [t1.micro]:  meep
Input invalid. Please try again.


+--------+------------------+-----------------------+--------------------------+
| OPTION | OPERATING SYSTEM |       IMAGE ID        |      CREATION DATE       |
+--------+------------------+-----------------------+--------------------------+
| 1.     | Amazon Linux 2   | ami-00af37d1144686454 | 2022-04-28T21:39:48.000Z |
+--------+------------------+-----------------------+--------------------------+
| 2.     | Ubuntu           | ami-0e8e7369d92f16d0a | 2022-05-06T19:22:40.000Z |
+--------+------------------+-----------------------+--------------------------+
| 3.     | Amazon Linux     | ami-01eef5991d5b0b06c | 2022-05-04T21:38:21.000Z |
+--------+------------------+-----------------------+--------------------------+
| 4.     | Red Hat          | ami-04a616933df665b44 | 2022-05-13T11:43:00.000Z |
+--------+------------------+-----------------------+--------------------------+
| 5.     | SUSE Linux       | ami-02d3156c437db95c5 | 2022-04-27T09:34:54.000Z |
+--------+------------------+-----------------------+--------------------------+
| 6.     | Windows          | ami-00a1fa460823055a5 | 2022-05-11T06:38:40.000Z |
+--------+------------------+-----------------------+--------------------------+
[ any image id ]: Select the image id
AMI [Latest Amazon Linux 2 image]:  merp
Input invalid. Please try again.

Environment

  • Austin, TX ; muggy
  • App Version: ALL
  • OS/Arch: ALL

CLI should have an inbuilt way to display its version number

Describe the feature
Currently there is no command to display the version number of the simple-ec2 executable. This makes it harder for users and maintainers working on bug reports to identify which version of the software is affected by the report.

Is the feature request related to a problem?
This does not affect the functioning of the software, it's merely a convenience for users and maintainers.

Describe alternatives you've considered
If the user installed through homebrew, they can run brew info aws-simple-ec2-cli to get the version number. If they built from source, they can inspect the "Install w/ Curl" section of README.md. If they installed via Curl, I'm not sure how to find the version number.

Ability to launch accelerated compute instances

Describe the feature
Not sure if it's a bug, but I'm unable to launch g5 family instances.
Is the feature request related to a problem?
When launching a g5.2xlarge, I get:

Creating spot instance failed: AMI 'ami-x' with an instance-store root device is not supported for the instance type 'g5.2xlarge'.

I've tried with both Ubuntu and Amazon Linux AMIs.

Offer an easy way to launch ARM64 instances in interactive mode

Describe the feature
As ARM64-based instances become more popular, developers may want to launch such instances with simple-ec2. The default instance type and all the suggested AMIs are AMD64-based. So while it is possible to to launch an ARM64 instance in interactive mode, there is not an easy default configuration, and it has some sharp edges (e.g., see this issue).

It would be nice if the interactive CLI gave a suggestion for an ARM64 instance type as well as an AMD64 instance type, even if AMD64 remains the default.

It would also be nice if, after the user selects and ARM64 instance type, the AMI sugggestions include only AMIs that will actually run on that instance type.

Is the feature request related to a problem?
This is a developer pain point, even though it's not a bug per se.

Describe alternatives you've considered
If you already know the instance type and AMI ID you want, you can theoretically launch ARM64 instances with either interactive mode or command-line flags.

Output software version?

I installed simple-ec2 on my Mac via homebrew, following the instructions on the README.md page. The version I got didn't support the --tags argument of the simple-ec2 launch command.

When I re-installed the latest release from github

curl -Lo simple-ec2 https://github.com/awslabs/aws-simple-ec2-cli/releases/download/v0.7.0/simple-ec2-`uname | tr '[:upper:]' '[:lower:]'`-amd64
chmod +x simple-ec2

I got a later (?) version of the CLI that knew about the --tags argument.

Perhaps it would be useful to output the version of the installed CLI (e.g. via a --version / -v argument), so users can see quickly whether have the latest version installed?

Update the default operating system images

Describe the feature
simple-ec2 suggests AMIs for several different operating system types (Amazon Linux, Windows, Ubuntu, etc.). Some of these may be outdated now. One particular example is Ubuntu: we are using 18.04 LTS, but there is a more recent long-term support version: 20.04. We should use that instead, and see if any of the other operating system versions ought to be bumped up as well.

(Or if wait for another month or two, we can upgrade directly to Ubuntu 22.04 LTS, which should be released in April 2022.)

Is the feature request related to a problem?
Using more recent OS versions will give users the latest features and security fixes. The biggest advantage is that the software repos (available via apt, yum, etc.) will have more recent versions of software users are likely to want to install once they get their instance.

Describe alternatives you've considered
Users can manually supply an AMI they prefer.

ssh connection should use "IdentitiesOnly yes" option

In some circumstances if your ssh-agent has a lot of keys, connecting fails e.g.:

Select the instance you want to connect to:

       INSTANCE                                │ TAG-KEY │ TAG-VALUE
     ──────────────────────────────────────────┼─────────┼────────────
   >   rt-dockertest12343(i-06ab0e3ff8715cad5) │         │
Connecting to instance failed: exit status 255Received disconnect from 34.236.152.159 port 22:2: Too many authentication failures
Disconnected from 34.236.152.159 port 22

A similar thing happens when trying to use the normal cli ssh command.

This issue is solved on the ssh command line with -o "IdentitiesOnly yes"; it would be good for this to also pass that option.

Support authentication with AWS SSO

I am using AWS SSO with temporary credentials, and need to switch between different roles. Perhaps that's worth supporting, e.g. via a --profile argument?

Tags incorrect for Spot instance

Describe the bug
(h/t @AustinSiu for finding this)

The Spot code does not properly set tags on the instance. I imagine this has something to do with using launch templates or CreateFleet API, rather than RunInstances like our On-Demand code path uses.

The spot support feature is on main but has not yet been released: #55. We should fix this before release.

Steps to reproduce
I used simple-ec2 launch -i to launch two instances with the same specs, one On-Demand and one Spot, and I set a tag myTag=myTagValue on both:

+--------------------------------------+-----------------------------------------------------+
| Region                               | us-east-2                                           |
| VPC                                  | simple-ec2 VPC(vpc-0646e30a60e5cfbee)               |
| Subnet                               | simple-ec2 Subnet(subnet-03f49777a68f0e0bc)         |
| Instance Type                        | t2.micro                                            |
| Capacity Type                        | On-Demand                                           |
| Image                                | ami-017a73c6475f1cefe                               |
| Security Group                       | simple-ec2 SSH Security Group(sg-0140d6773625eedd8) |
| Keep EBS Volume(s) After Termination | false                                               |
| Auto Termination Timer in Minutes    | 30                                                  |
| EBS Volumes                          | /dev/xvda(gp2): 8 GiB                               |
| Tag Specification(key|value)         | myTag|myTagValue                                    |
+--------------------------------------+-----------------------------------------------------+

+--------------------------------------+-----------------------------------------------------+
| Region                               | us-east-2                                           |
| VPC                                  | simple-ec2 VPC(vpc-0646e30a60e5cfbee)               |
| Subnet                               | simple-ec2 Subnet(subnet-03f49777a68f0e0bc)         |
| Instance Type                        | t2.micro                                            |
| Capacity Type                        | Spot                                                |
| Image                                | ami-017a73c6475f1cefe                               |
| Security Group                       | simple-ec2 SSH Security Group(sg-0140d6773625eedd8) |
| Keep EBS Volume(s) After Termination | false                                               |
| Auto Termination Timer in Minutes    | 30                                                  |
| EBS Volumes                          | /dev/xvda(gp2): 8 GiB                               |
| Tag Specification(key|value)         | myTag|myTagValue                                    |
+--------------------------------------+-----------------------------------------------------+

Expected outcome
When I run simple-ec2 connect -i, you can see the tags for each instance. The first one in this list is the Spot instance, and you'll notice the lack of tags CreatedBy and CreatedTime (added automatically by Simple-EC2) and myTag (requested by me).

+--------+---------------------+-------------------------------+--------------------------------------------+
| OPTION |      INSTANCE       |            TAG-KEY            |                 TAG-VALUE                  |
+--------+---------------------+-------------------------------+--------------------------------------------+
| 1.     | i-0787ce0ef3ad5a97a | aws:ec2launchtemplate:id      | lt-05a49f8daa6e98b80                       |
|        |                     | aws:ec2:fleet-id              | fleet-9f3feb84-5326-ecbe-aeba-858ad9094622 |
|        |                     | aws:ec2launchtemplate:version | 1                                          |
| 2.     | i-0c944fe3155bc43fe | myTag                         | myTagValue                                 |
|        |                     | CreatedBy                     | simple-ec2                                 |
|        |                     | CreatedTime                   | 2022-08-03 09:44:51 CDT                    |
+--------+---------------------+-------------------------------+--------------------------------------------+

The tags for a Spot instance should match those for an On-Demand instance.

Application Logs
See output above.

Environment

  • App Version: v0.8.2-2-g20ee196
  • OS/Arch: macOS 12.4

Can't supply an AMI ID in the interactive interface

Describe the bug
Supplying my own AMI ID directly via flags works fine, but trying to supply one via the interactive interface fails.

Steps to reproduce

  1. Run simple-ec2 launch -i
  2. Follow all the prompts but select an ARM instance type, such as t4g.micro (This might not be necessary, but the AMI ID I'm using is ARM64)
  3. When you get to the AMI selection screen, paste in ami-088e1f338c3b87d1a

Result: simple-ec2 crashes.

Expected outcome
simple-ec2 should accept that AMI ID and continue on

Workaround:

Supplying the AMI ID directly on the command line works fine, such as

simple-ec2 launch -t t4g.micro -m ami-088e1f338c3b87d1a ...

Environment

  • App Version: 0.6.0
  • OS/Arch: MacOS 12.2 Intel

Auto-terminate doesn't work on Windows instances

Describe the bug
simple-ec2 offers a feature to auto-terminate an instance you launch a certain number of minutes after its creation. This is nice for testing where you only need an instance for a short amount of time, since you don't have to worry about cleanup.

However, this mechanism only works on Linux instances, not Windows instances.

Steps to reproduce:

  1. Run simple-ec2 launch -i
  2. Use any values you like but specify the following:
    1. Windows AMI
    2. Auto-terminate timer of some short duration (e.g., 15 minutes)
  3. Launch the instance, wait a few minutes, and verify that the instance is running (it will show up in the AWS Console or in the list in simple-ec2 connect -i
  4. Wait 15 minutes

Result: The Windows instance is still running and it did not terminate

Expected outcome:

The Windows instance should terminate after the set time. If this is not possible, simple-ec2 should not give the user that option when selecting a Windows AMI.

This mechanism is implemented with a "shut down in the future" command in the userdata script, but that command is specific to Linux. It may be possible to do this in Windows with the following PowerShell command:

shutdown -s -t <TimeInSeconds>

Workaround:

Manually terminate the instance with simple-ec2 terminate or via the AWS Console

Environment

  • App Version: 0.6.0
  • OS/Arch: MacOS 12.2 Intel

Revamp the UX to use Bubble Tea

Describe the feature

The current UX for Simple-EC2 lacks some features that a Terminal User Interface (TUI) library like Bubble Tea would afford. Let's rewrite the interactive questionnaire to use Bubble Tea, and improve some of the questions where possible.

Is the feature request related to a problem?

The default value for any given list is shown in square brackets next to the prompt. The user has to read the table, read the default, and then evaluate whether that's the value they want. We could instead write these tables with a scrollable list that positions the cursor on the default when first rendered, making it very clear which option the user will get if they just hit enter and take the default.

Selecting security groups is particularly difficult in the current implementation. The user is presented with the list of available security groups multiple times and asked to select an additional one or say they're done adding groups. This would be much easier with a multi-select list.

Terminating multiple instances also has this issue and would be better with a multi-select list.

Entering tags for an instance requires the user to type a very specific syntax (tag|value,tag|value), which is easy to mess up. We could write a more intuitive interface for this that clearly outlines the "key" and "value" inputs and shows a table for tags already added to the instance. The table could also allow us to delete existing tags.

Describe alternatives you've considered

The existing UX is fine and it works, but this would be a usability improvement.

Default options change for simple-ec2 config

Describe the feature
A concise description of the feature and desired behavior.
When using the interactive mode for simple-ec2 launch the defaults for each question are static and defined by pre-set values. These default values should instead be the defaults set in the simple-ec2.json file that are used to set the defaults in the non interactive mode.

Is the feature request related to a problem?
A description of what the problem is. For example: I'm frustrated when [...]
When using interactive mode I would want to change one or two configurations. Having the defaults represent the user set configurations will make it so they don't have to re-insert them. They can just hit enter instead of having to retype everything.

Describe alternatives you've considered
A description of any alternative solutions or features you've considered.
The flags can be used instead to skip these steps, but this also involves typing out already set defaults.

Connecting to an Ubuntu instance fails

Describe the bug
When using simple-ec2 connect to log in to an EC2 instance using an AMI that is not a flavor of Amazon Linux, user encounters an SSH error "Permission denied (publickey)". This is because our EC2 Instance Connect helper code hardcodes the username of ec2-user, which is not correct for Ubuntu. The username in that case should be ubuntu. Red Hat and SUSE instances also fail to connect, but I'm not sure if they are because of the username or something else.

Steps to reproduce

  1. Launch an instance with any configuration and an Ubuntu AMI, using simple-ec2 launch
  2. Attempt to connect to that instance with simple-ec2 connect

Expected outcome
simple-ec2 connect should open an SSH connection and present the user with a shell to the instance. These steps work correctly for instances based on an Amazon Linux AMI.

Application Logs

Connecting to instance failed: exit status 255Warning: Permanently added 'ec2-3-143-5-51.us-east-2.compute.amazonaws.com' (ED25519) to the list of known hosts.
[email protected]: Permission denied (publickey).

Environment

  • App Version: 0.8.2
  • OS/Arch: macOS 12.4

manually specify key pair name when launching ec2?

Describe the feature
I want to specify a key pair name when launching an instance so that I can connect to the instance via SSH. I need to use SSH because I want to use SSH Agent Forwarding and SSH Tunnels which are not supported by simple-ec2 connect.

Is the feature request related to a problem?
I saw there's a PEM file in the ~/simple-ec2 folder but I can't use it to SSH like: ssh -i ~/.simple-ec2/instance_connect.pem [email protected].

Describe alternatives you've considered
I could just make the EC2 on the AWS Console but what's the fun in that :)

Incorrect region applied when interactive mode is used.

Describe the bug
When launching via interactive mode, if the "eu-west-1" region is selected, the proceeding steps create resources in the eu-central-2 region, which is not included in the orginal list selection in the first place (probably as it is an opt-in region)

Steps to reproduce
Quick launch an instance with -i flag

Expected outcome
Would expect eu-west-1 region to apply when selected

Application Logs
see image
Screenshot 2023-07-03 at 17 35 57

Environment
zsh iterm2 shell

  • App Version: 0.10.0
  • OS/Arch: zsh, MacOS Monterrey 12.6.6
    zsh, MacOS Monterrey 12.6.6

No way to specify capacity type with CLI flag

Describe the bug
The Simple-EC2 CLI has flags for all attributes of an instance. However, when we added Spot support recently (#55), we did not include a CLI flag to choose between Spot and On-Demand. The only way to choose capacity type is through interactive mode.

Steps to reproduce
simple-ec2 launch -h does not list an option for specifying capacity type.

Expected outcome
We should add a new flag to set this attribute from the CLI, perhaps called --capacity-type. It should accept case-insensitive values of "spot" or "on-demand" and have appropriate parsing and error handling logic.

Application Logs
N/A

Environment

  • App Version: v0.8.2-2-g20ee196
  • OS/Arch: macOS 12.4

Request Spot instance

Describe the feature
I'd like to request a Spot instance using simple-ec2 cli

Is the feature request related to a problem?
N/A

Describe alternatives you've considered
Using on-demand instance and not saving up to 90%

`CreatedTime` date formatting doesn't conform to ISO 8601

Describe the bug
When launching an instance via simple-ec2 launch, one of the tags on the instance is CreatedTime. This tag has a date that lacks leading zeros for single-digit months and dates. It would look better if we formatted the date in ISO 8601 (YYYY-MM-DD).

Steps to reproduce
Launch an instance using any options in simple-ec2 launch. Then, run simple-ec2 connect -i to get the list of instances in interactive mode. Sample output shows the date format:

+--------+---------------------+-------------+-----------------------+
| OPTION |      INSTANCE       |   TAG-KEY   |       TAG-VALUE       |
+--------+---------------------+-------------+-----------------------+
| 1.     | i-01b40315751cf876e | CreatedBy   | simple-ec2            |
|        |                     | CreatedTime | 2022-4-6 13:55:24 CDT |
+--------+---------------------+-------------+-----------------------+
Select the instance you want to connect to: :

Expected outcome
The date should be formatted as 2022-04-06. Not sure if the time formatting has the same issue, but it's worth checking too.

Application Logs
N/A

Environment

  • App Version: 0.8.0
  • OS/Arch: MacOS 12.3, amd64

Upgrade ubuntu image to the latest LTS

Describe the feature

"instance-store": "ubuntu/images/hvm-instance/ubuntu-bionic-18.04-*-server-????????",

If you see above, ubuntu version being used is 18.04. It would be great if this can be upgraded to the latest LTS release viz 22.04

If 22.04 cannot be default i would be a great UX to show a list where the user can choose which is the version of ubuntu they want

Feature request: stop & restart an instance

This is a great CLI tool - and it could be even better if it also supported

  • stopping a running EC2 instance
  • restarting a stopped EC2 instance

Many thanks for making AWS better every day!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.