It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
Highlighted

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

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

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

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?

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

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
Community showcase
Published in Bamboo

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

355 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you