Skip to content

[JENKINS-72622] EC2 plugin cannot add a new cloud #16344

Closed

Description

@jenkins-infra-bot
  1. I created an EC2 instance and subsequently generated an Amazon Machine Image (AMI) from this instance.
  1. I added the EC2 plugin to Jenkins to use this AMI. In the "New Cloud" section, I filled in the following fields:
    • Name
    • Amazon EC2 credentials
    • Region
    • EC2 Key Pair's Private Key
      Upon testing the connection, I received a success response. I then proceeded to the "Add AMI" section.
  1. In the "Add AMI" section, I filled in the following fields:
    • Description
    • AMI ID
    • Instance Type (T2XLarge)
    • Security group names
    • Remote FS root
    • Remote user
    • AMI Type
    • Labels
      I selected "Usage = Only build jobs with label expressions matching this node," and filled in Subnet IDs for VPC and Tags. I also checked "Associate Public IP" and chose "Private IP" as the Connection Strategy.
  1. When I clicked the "Save" button, I encountered an error message on my screen: "A problem occurred." Upon reviewing the system logs, I identified the error as follows:
    • java.lang.NullPointerException at jenkins.agents.CloudSet.doDoCreate
  1. I am using the following versions:
    • Jenkins: 2.414.1
    • Amazon EC2 plugin: Version1648.vf3d852e00486
    • Amazon Web Services SDK :: EC2: Version1.12.633-430.vf9a_e567a_244f
    • Amazon Web Services SDK :: Minimal: Version1.12.633-430.vf9a_e567a_244f
    • Pipeline: Step API: Version639.v6eca_cd8c04a_a_
    • Apache HttpComponents Client 4.x API: Version4.5.14-208.v438351942757
    • AWS Credentials: Version218.v1b_e9466ec5da_
    • Bouncycastle API: Version2.29
    • Command Agent Launcher: Version107.v773860566e2e
    • Credentials: Version1311.vcf0a_900b_37c2
    • Node Iterator API: Version49.v58a_8b_35f8363
    • SSH Credentials: Version308.ve4497b_ccd8f4
    • Trilead API: Version2.84.v72119de229b_7

Could you please assist me in identifying what might be missing or causing this issue? Any guidance or support would be greatly appreciated.


Originally reported by sberfdalar, imported from: EC2 plugin cannot add a new cloud
  • assignee: allan_burdajewicz
  • status: Closed
  • priority: Major
  • component(s): core, ec2-plugin
  • label(s): 2.452.2-fixed, ec2, jenkins, plugin
  • resolution: Fixed
  • resolved: 2024-05-21T14:13:26+00:00
  • votes: 4
  • watchers: 7
  • imported: 2025-11-24
Raw content of original issue
  1. I created an EC2 instance and subsequently generated an Amazon Machine Image (AMI) from this instance.
  1. I added the EC2 plugin to Jenkins to use this AMI. In the "New Cloud" section, I filled in the following fields:
    • Name
    • Amazon EC2 credentials
    • Region
    • EC2 Key Pair's Private Key Upon testing the connection, I received a success response. I then proceeded to the "Add AMI" section.
  1. In the "Add AMI" section, I filled in the following fields:
    • Description
    • AMI ID
    • Instance Type (T2XLarge)
    • Security group names
    • Remote FS root
    • Remote user
    • AMI Type
    • Labels I selected "Usage = Only build jobs with label expressions matching this node," and filled in Subnet IDs for VPC and Tags. I also checked "Associate Public IP" and chose "Private IP" as the Connection Strategy.
  1. When I clicked the "Save" button, I encountered an error message on my screen: "A problem occurred." Upon reviewing the system logs, I identified the error as follows:
    • java.lang.NullPointerException at jenkins.agents.CloudSet.doDoCreate
  1. I am using the following versions:
    • Jenkins: 2.414.1
    • Amazon EC2 plugin: Version1648.vf3d852e00486
    • Amazon Web Services SDK :: EC2: Version1.12.633-430.vf9a_e567a_244f
    • Amazon Web Services SDK :: Minimal: Version1.12.633-430.vf9a_e567a_244f
    • Pipeline: Step API: Version639.v6eca_cd8c04a_a_
    • Apache HttpComponents Client 4.x API: Version4.5.14-208.v438351942757
    • AWS Credentials: Version218.v1b_e9466ec5da_
    • Bouncycastle API: Version2.29
    • Command Agent Launcher: Version107.v773860566e2e
    • Credentials: Version1311.vcf0a_900b_37c2
    • Node Iterator API: Version49.v58a_8b_35f8363
    • SSH Credentials: Version308.ve4497b_ccd8f4
    • Trilead API: Version2.84.v72119de229b_7

Could you please assist me in identifying what might be missing or causing this issue? Any guidance or support would be greatly appreciated.

3 attachments

Activity

  1. jenkins-infra-bot commented on Jan 28, 2024

    @jenkins-infra-bot
    Author
  2. jenkins-infra-bot commented on Feb 10, 2024

    @jenkins-infra-bot
    Author
    carlos_devops:
    • Original comment link
    • Raw content of original comment:

      I have the same problem but so far I can't fix it

    I have the same problem but so far I can't fix it

  3. jenkins-infra-bot commented on Mar 5, 2024

    @jenkins-infra-bot
    Author
    ttjenkins:
    • Original comment link
    • Raw content of original comment:

      We have same issue when creating new cloud, this is major impact, please help to check and fix! Thanks

    We have same issue when creating new cloud, this is major impact, please help to check and fix! Thanks

  4. jenkins-infra-bot commented on Mar 15, 2024

    @jenkins-infra-bot
    Author
    elkhan:
    • Original comment link
    • Raw content of original comment:

      IMHO, It would be better to update the title to "Cannot add a new cloud"

      Attached full log and list of installed plugins.

      Environment:

      Jenkins: `2.440.1 LTS` OS: AlmaLinux OS 8.9

      Java
      openjdk version "21.0.2" 2024-01-16 LTS
      OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
      OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)
      

      plugin_list.txt jenkins_journalctl.log

    IMHO, It would be better to update the title to "Cannot add a new cloud"

    Attached full log and list of installed plugins.

    Environment:

    Jenkins: `2.440.1 LTS`
    OS: AlmaLinux OS 8.9

    Java
    openjdk version "21.0.2" 2024-01-16 LTS
    OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
    OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)
    

    plugin_list.txt
    jenkins_journalctl.log

  5. jenkins-infra-bot commented on Apr 8, 2024

    @jenkins-infra-bot
    Author
    andyshinn:
    • Original comment link
    • Raw content of original comment:

      I'm struggling with this one and it is making it difficult to test a new AMI we want to use. Is there a known previous version that is working fine? Anyone found any workaround?

    I'm struggling with this one and it is making it difficult to test a new AMI we want to use. Is there a known previous version that is working fine? Anyone found any workaround?

  6. jenkins-infra-bot commented on Apr 23, 2024

    @jenkins-infra-bot
    Author
    allan_burdajewicz:

    This only happens when creating a New Cloud and adding AMIs in one go.
    The root cause is:

    And the fact that EC2 plugin SlaveTemplate has a field with name type that overrides the hidden field of the CloudSet:

    The workaround is to create the Cloud first, without AMIs and save. And then configure the cloud and add AMIs.

  7. jenkins-infra-bot commented on Apr 23, 2024

    @jenkins-infra-bot
    Author
    allan_burdajewicz:
    • Original comment link
    • Raw content of original comment:

      Not 100% sure if this is a bug for ec2 or core or both. The hidden attribute name type causes the regression and is quite generic. It could maybe be renamed to avoid conflict in the future, to for example cloudSetType for example. For ec2, changing the attribute name in SlaveTemplate could scope to all sorts of impact (persistence, casc, ...). So need to be careful if we go down that road. cc vlatombe WDYT, does this need a change in core, in ec2-plugin or both ?

    Not 100% sure if this is a bug for ec2 or core or both. The hidden attribute name type causes the regression and is quite generic. It could maybe be renamed to avoid conflict in the future, to for example cloudSetType for example. For ec2, changing the attribute name in SlaveTemplate could scope to all sorts of impact (persistence, casc, ...). So need to be careful if we go down that road.
    cc vlatombe WDYT, does this need a change in core, in ec2-plugin or both ?

  8. jenkins-infra-bot commented on Apr 23, 2024

    @jenkins-infra-bot
    Author
    vlatombe:
    • Original comment link
    • Raw content of original comment:

      allan_burdajewicz I agree with you, I think we should change this in core to avoid hitting any conflict with plugins.

    allan_burdajewicz I agree with you, I think we should change this in core to avoid hitting any conflict with plugins.

  9. jenkins-infra-bot commented on Apr 26, 2024

    @jenkins-infra-bot
    Author
    allan_burdajewicz:

    Proposed #9198

  10. jenkins-infra-bot commented on May 16, 2024

    @jenkins-infra-bot
    Author
    andyshinn:
    • Original comment link
    • Raw content of original comment:

      I din't see the PR merged. But in the latest LTS 2.452.1 this no longer appears to be an issue for me. I am able to save the EC2 agent and it is working now.

    I din't see the PR merged. But in the latest LTS 2.452.1 this no longer appears to be an issue for me. I am able to save the EC2 agent and it is working now.

  11. jenkins-infra-bot commented on May 20, 2024

    @jenkins-infra-bot
    Author
    elkhan:
    • Original comment link
    • Raw content of original comment:

      andyshinn Just tested. Still doesn't work.

      Amazon EC2 plugin Version: 

      1688.v8c07e01d657f

      Jenkins: 

      2.452.1 LTS

       

    andyshinn Just tested. Still doesn't work.

    Amazon EC2 plugin Version: 

    1688.v8c07e01d657f

    Jenkins: 

    2.452.1 LTS

     

  12. jenkins-infra-bot commented on May 23, 2024

    @jenkins-infra-bot
    Author
    allan_burdajewicz:
    • Original comment link
    • Raw content of original comment:

      Again, the scenario when this happen is when creating a EC2 Cloud and defining AMI Templates all in go and then hit Save. As a workaround, you can create the EC2 Cloud, hit save, and then define your AMI Templates and that should work.

    Again, the scenario when this happen is when creating a EC2 Cloud and defining AMI Templates all in go and then hit Save. As a workaround, you can create the EC2 Cloud, hit save, and then define your AMI Templates and that should work.

  13. jenkins-infra-bot commented on May 24, 2024

    @jenkins-infra-bot
    Author
    elkhan:
    • Original comment link
    • Raw content of original comment:

      allan_burdajewicz , Thanks a lot for the fix!

      Yes, I know it. I just wanted give a try after andyshinn 's comment.

      Since, It's merged and included 2.459 release and I see that the PR marked with "developer" label which has "Changes which impact plugin developers" description.

      Does it mean it can be included on the next LTS update rather than just as a small update to the current LTS version?

    allan_burdajewicz , Thanks a lot for the fix!

    Yes, I know it. I just wanted give a try after andyshinn 's comment.

    Since, It's merged and included 2.459 release and I see that the PR marked with "developer" label which has "Changes which impact plugin developers" description.

    Does it mean it can be included on the next LTS update rather than just as a small update to the current LTS version?

  14. jenkins-infra-bot commented on May 27, 2024

    @jenkins-infra-bot
    Author
    allan_burdajewicz:

    It's been accepted and backported in the next LTS 2.452.2 #9305

  15. removed
    bugFor changelog: Minor bug. Will be listed after features
    on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions