I have a CloudFormation stack that deploys various AWS resources, S3 bucket excluded, i create the S3 Bucket (To fill with my zipped Lambdas) in my GitHub Actions workflow main.yml file which works fine, when i delete the deployed CloudFormation Stack, the S3 bucket i configure stays up (obviously). How could i automate this however?
name: Deploy to AWS
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# ...
- name: Create S3 bucket
run: |
aws s3api create-bucket --bucket sumting-2-lambdas --region eu-central-1 --create-bucket-configuration LocationConstraint=eu-central-1
# ...
- name: Deploy CloudFormation Stack
run: |
aws cloudformation deploy \
--template-file template.yaml \
--stack-name sumting-2 \
--capabilities CAPABILITY_IAM
# ...
So far i haven't tried much since i can't figure out a way to do this as optimal as possible.