How to delete S3 object using bamboo plan/script to delete S3 object using bamboo

BeingDarsh July 28, 2019

I want to delete S3 files from the bucket by creating a bamboo plan/script which when run will delete the file.

I tried creating a plan and then creating a task. But in the task i can see no option for Amazon S3 Object in the list. I have refered to the below url and followed the steps:https://utoolity.atlassian.net/wiki/spaces/TAWS/pages/19464196/Using+the+Amazon+S3+Object+task+in+Bamboo

Is there any other way i can create a bamboo plan and delete files from S3???

2 comments

Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 29, 2019

Hi @BeingDarsh,

Welcome to the Atlassian Community!

If I understand you correctly, you are unable to see the Amazon S3 Object task in the dialog when you try to Create a task for a job in Bamboo?

This task is part of the (commercial) Tasks for AWS (Bamboo) app, which you can install from the Atlassian Marketplace. As with all apps, you can always evaluate it first by clicking the yellow Try it free button in the top right of the Marketplace listing.

  • Disclaimer: I'm a co-founder of this app's vendor Utoolity.

Alternative

If you would rather not use a dedicated task for S3, you could also use the AWS CLI's high level S3 commands via the built-in Bamboo Script task, for example aws.s3.rm covers your use case.

Please note that this usually requires an AWS Access Key, which violates the AWS security best practice to not store and expose long-term credentials in insecure environments. You could address this by using our Identity Federation for AWS (Bamboo) app to provide temporary AWS credentials at runtime, as outlined in How to provide temporary AWS credentials to the AWS Command Line Interface (AWS CLI) via Bamboo variables.

  • While this app is also a commercial offering, it has a lower price point than Tasks for AWS (where it's also included for free btw.).

Cheers,
Steffen

Like # people like this
BeingDarsh August 1, 2019

Hi Steffen,

Thanks for your revert.

I have tried the steps which you had provided.

I have created a plan, then i created a task wherein i have added task by selecting type as Script. And then followed the steps given in https://confluence.atlassian.com/bamboo/script-289277046.html?_ga=2.206651157.703612990.1564645603-979275457.1562814553

In the script i have written command as attached in screenshot "Bamboo_Task.PNG".

But when i run the plan i get error as below:

(line 2: $: command not found).

Bamboo_Task.PNGBamboo_Plan.PNG

 

Also i have set the variables under the variables tab and also i have added a local agent under requirement tab but it gives an error when clicked on the Defalut Job as "No agents meet this job's requirements."

Can you please check and correct me where i am wrong?

Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 1, 2019

There seem to be two different issues eventually:

1. Missing AWS CLI

But when i run the plan i get error as below:

(line 2: $: command not found).

The missing command here is 'aws', which is the AWS Command Line Interface (AWS CLI) and may need to be installed on your agent first.

I think all Bamboo stock images for Elastic Bamboo have it installed by default meanwhile, but if you are using a custom image, or a remote or local agent, you may need to install it yourself - please refer to Installing the AWS CLI for instructions.

2. Missing job requirements

The "No agents meet this job's requirements" error usually needs to be taken literally. What do you mean exact when you say that you have "added a local agent under requirement tab", and can you show me the "Required capability" list from the requirements tab so that we can analyze which requirement is not met?

Like BeingDarsh likes this
BeingDarsh August 1, 2019

Hi Steffen,

Thank you so much for your help :-)

I managed to run the plan successfully.

There were some minor mistakes which i had made after correcting it worked.

Like Steffen Opel _Utoolity_ likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events