Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

proper logical order when deploying multiple resources using cloudformation

dataking November 10, 2021

Hey community,

 

I am using bitbucket-pipelines.yml to deploy a cloudformation using the atlassian/aws-cloudformation-deploy:0.12.0 pipe and my lambda function to s3 using the atlassian/aws-s3-deploy:1.1.0 pipe.

I have all of my resources being created in the cloudformation template. The resources include an S3 bucket, and lambda function which is referencing the zip file code in the S3 bucket.

I keep running into issues because I cant ( or at least I dont think I can) put the S3 pipe before the cloudformation template because the bucket would not be created, and if I put the S3 pipe after the cloudformation pipe it will fail because the lambda function cloudformation step tries to reference the zipped code in the S3 bucket, which the S3 pipe is supposed to upload.

Any recommendations? I could potentially have separate cloudformation templates for each resource and create a new step in the bitbucket-pipelines.yml, but it seems a bit more challenging to manage all the files, but maybe not?

Any suggestions?

1 answer

1 accepted

0 votes
Answer accepted
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 19, 2021

@dataking  hi. Thanks for your question. Try this to split logic:

step:
script:
  - pipe: atlassin/cloudformation-deploy:0.12.0
    <create s3 bucket from template>
  - pipe: atlassian/aws-s3-deploy:1.1.0
    <deploy to s3>
- pipe: atlassin/cloudformation-deploy:0.12.0
  <create lambda>

Regards, Igor

dataking December 6, 2021

Hey @Igor Stoyanov with this approach, wouldn't I require 2 separate cloud formation templates? In other words, step 1 would contain the CF for S3, where as step 3 would contain a separate CF template with lambda resources.

Is that correct?

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 7, 2021

@dataking hi. Yes, you need to create 2 separate cloudformation templates.

dataking December 7, 2021

@Igor Stoyanov how do you recommend to manage that at scale? Imagine we are dealing with many resources in the same repository.

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 8, 2021

@dataking  hi. Please, describe your case with more details.

Do you have known count of lambdas? And how many lambdas if count is known?

Regards, Igor.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events