Jenkins Setup
10 minutesPrerequisites
Before you begin, ensure you have:
- Jenkins server (version 2.300 or later)
- A Jenkins agent in the same AWS VPC as your target EC2 instances
- SSH key pair for authentication to target hosts
- AppDynamics Smart Agent package
- Target Ubuntu EC2 instances with SSH access
Required Jenkins Plugins
Install these plugins via Manage Jenkins → Plugins → Available Plugins:
- Pipeline (core plugin, usually pre-installed)
- SSH Agent Plugin
- Credentials Plugin (usually pre-installed)
- Git Plugin (if using SCM)
To install:
- Navigate to Manage Jenkins → Plugins
- Click Available tab
- Search for each plugin
- Select and click Install
Configure Jenkins Agent
Your Jenkins agent must be able to reach target EC2 instances via private IPs. There are two main options:
Option A: EC2 Instance as Agent
Launch EC2 instance in same VPC as your target hosts
Install Java (required by Jenkins):
Add agent in Jenkins:
- Go to Manage Jenkins → Nodes → New Node
- Name:
aws-vpc-agent(or your preferred name) - Type: Permanent Agent
- Configure:
- Remote root directory:
/home/ubuntu/jenkins - Labels:
linux(must match pipeline agent label) - Launch method: Launch agent via SSH
- Host: EC2 private IP
- Credentials: Add SSH credentials for agent
- Remote root directory:
Option B: Use Existing Linux Agent
- Ensure agent has label
linux - Verify network connectivity to target hosts
- Confirm SSH client is installed
Configure Agent Labels
Warning
All pipelines in this workshop use the linux label. Make sure your agent is configured with this label.
To set or modify labels:
- Go to Manage Jenkins → Nodes
- Click on your agent
- Click Configure
- Set Labels to
linux - Click Save
Credentials Setup
Navigate to: Manage Jenkins → Credentials → System → Global credentials (unrestricted)
You’ll need to create three credentials for the pipelines to work.
1. SSH Private Key for Target Hosts
This credential allows Jenkins to SSH into your target EC2 instances.
Type: SSH Username with private key
- ID:
ssh-private-key(must match exactly) - Description:
SSH key for EC2 target hosts - Username:
ubuntu(or your SSH user) - Private Key: Choose one:
- Enter directly: Paste your PEM file content
- From file: Upload PEM file
- From Jenkins master: Specify path
Example format:
2. Deployment Hosts List
This credential contains the list of all target hosts where Smart Agent should be deployed.
Type: Secret text
- ID:
deployment-hosts(must match exactly) - Description:
List of target EC2 host IPs - Secret: Enter newline-separated IPs
Example:
Important
Format Requirements:
- One IP per line
- No commas
- No spaces
- No extra characters
- Use Unix line endings (LF, not CRLF)
3. AppDynamics Account Access Key
This credential contains your AppDynamics account access key for Smart Agent authentication.
Type: Secret text
- ID:
account-access-key(must match exactly) - Description:
AppDynamics account access key - Secret: Your AppDynamics access key
Example: abcd1234-ef56-7890-gh12-ijklmnopqrst
Tip
You can find your AppDynamics access key in the Controller under Settings → License → Account.
Credential Security Best Practices
Follow these best practices for credential management:
- ✅ Use Jenkins credential encryption (built-in)
- ✅ Restrict access via Jenkins role-based authorization
- ✅ Rotate SSH keys periodically
- ✅ Use least-privilege IAM roles for EC2 instances
- ✅ Enable audit logging for credential access
- ✅ Never commit credentials to version control
Smart Agent Package Setup
The Smart Agent ZIP file should be placed in a location accessible to Jenkins. The recommended approach is to store it in the Jenkins home directory.
Download Smart Agent
Storage Location
The pipelines reference the Smart Agent ZIP at: /var/jenkins_home/smartagent/appdsmartagent.zip
You can either:
- Place the ZIP at this exact location
- Modify the
SMARTAGENT_ZIP_PATHpipeline parameter to point to your ZIP location
Verify Configuration
Before proceeding to pipeline creation, verify your setup:
1. Check Agent Status
- Go to Manage Jenkins → Nodes
- Verify your agent shows as “online”
- Confirm label is set to
linux
2. Test SSH Connectivity
Create a simple test pipeline to verify SSH works:
3. Verify Credentials Exist
- Go to Manage Jenkins → Credentials
- Confirm all three credentials are listed:
ssh-private-keydeployment-hostsaccount-access-key
Troubleshooting Common Issues
Agent Not Available
Symptom: “No agent available” error when running pipelines
Solution:
- Check: Manage Jenkins → Nodes
- Ensure agent is online
- Verify agent has
linuxlabel - Test agent connectivity
SSH Connection Failures
Symptom: Cannot connect to target hosts via SSH
Solution:
Credential Not Found
Symptom: “Credential not found” error
Solution:
- Verify credential IDs exactly match:
ssh-private-keydeployment-hostsaccount-access-key
- Check credential scope is set to Global
Permission Denied on Target Hosts
Symptom: SSH succeeds but commands fail with permission denied
Solution:
Next Steps
Now that Jenkins is configured with credentials and agents, you’re ready to create the deployment pipelines!