North-Seattle-College / ad440-winter2021-thursday-repo

NSC AD 440 Winter 2021 Thursday cohort practicum repo
Apache License 2.0
2 stars 27 forks source link

CloudFormation RDS Deploy Script #276

Closed jleeboyd closed 3 years ago

jleeboyd commented 3 years ago

Description

Resolves #239

This PR adds a script to deploy a basic RDS with CloudFormation. See branch 239 for original commit history.

To Test:

Note: For this script you must use your personal AWS credentials (key id and secret) given at the start of last quarter, and not the secrets in our Azure key vault.

This script requires boto3, you may need to pip install if you do not have it.

  1. Navigate to Automation/RDS
  2. In the command line type python3 deploy.py aws_access_key aws_access_secret stack_name DBUser DBPassword
    • Where each parameter after 'deploy.py' is your parameter entry.
    • Example: python3 deploy.py ABCDEFG A1B2C3 jbTestStack jbTestAdmin 12345678
  3. If all goes well, you should then see a successful creation, along with the stack response data.
  4. Navigate to AWS CloudFormation and check that your stack is being created.
  5. After around 5-7 minutes your RDS stack should successfully create. Afterword please delete your stack, although you may not be able to...
  6. The script has pretty basic error handling, but feel free to test it out and see if anything breaks strangely.
Time Spent DATE ACTIVITY TIME
3/7 Initial research into Cloudformation and boto3 2 hours
3/9 Read up on multiple deployment options 2 hours
3/13 Write out script and research IAM errors 2.5 hour
3/15 Finish script and test 2.5 hour

Total time: ~9hr

ahmadafrasiyab commented 3 years ago

Installed Boto3, changed to the directory, having a bit of an issue running the script I get this

botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the CreateStack operation: Parameter DBPassword failed to satisfy constraint: must contain only alphanumeric characters.

Assuming aws-rds-username and aws-rds-password are the correct credentials for DB?

jleeboyd commented 3 years ago

@ahmadafrasiyab You've got the right idea but I think you need to remove the dashes '-' from your username and password. Also to clarify you are setting your own credentials for the RDS you are creating, and not accessing with an existing username and password.

unicornsleuth commented 3 years ago

I couldn't get it to recognize boto3 after I did a pip install, so I was unable to test this, but it looks good and you've got the approvals!