Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy census tables to Prod S3 #4271

Closed
Tracked by #4277
gsa-suk opened this issue Sep 10, 2024 · 1 comment
Closed
Tracked by #4277

Copy census tables to Prod S3 #4271

gsa-suk opened this issue Sep 10, 2024 · 1 comment
Assignees

Comments

@gsa-suk
Copy link
Contributor

gsa-suk commented Sep 10, 2024

09/10/24 - Copy census historical tables from GFE to Prod S3: (Sudha, Matt, Rochelle)

# — To copy final census tables from GFE to Prod S3
# — Total size of sql files: ~ 4 GB
# — Total size of census tables: ~ 5 GB


# cf login -a https://api.fr.cloud.gov/ --sso
# Select Production

cf target -s production

export PROD_SERVICE_INSTANCE_NAME=fac-private-s3
export PROD_KEY_NAME=sk-fac-private-s3

cf create-service-key "${PROD_SERVICE_INSTANCE_NAME}" "${PROD_KEY_NAME}"
export PROD_S3_CREDENTIALS=$(cf service-key "${PROD_SERVICE_INSTANCE_NAME}" "${PROD_KEY_NAME}" | tail -n +2)

export PROD_AWS_ACCESS_KEY_ID=$(echo "${PROD_S3_CREDENTIALS}" | jq -r '.credentials.access_key_id')
export PROD_AWS_SECRET_ACCESS_KEY=$(echo "${PROD_S3_CREDENTIALS}" | jq -r '.credentials.secret_access_key')
export PROD_BUCKET_NAME=$(echo "${PROD_S3_CREDENTIALS}" | jq -r '.credentials.bucket')
export PROD_URI=$(echo "${PROD_S3_CREDENTIALS}" | jq -r '.credentials.uri')
export PROD_AWS_DEFAULT_REGION=$(echo "${PROD_S3_CREDENTIALS}" | jq -r '.credentials.region')
export AWS_ACCESS_KEY_ID=$PROD_AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=$PROD_AWS_SECRET_ACCESS_KEY
export AWS_DEFAULT_REGION=$PROD_AWS_DEFAULT_REGION

aws s3 cp census_historical_migration_elecueis.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_elecueis.pgsql
aws s3 cp census_historical_migration_eleccpas.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_eleccpas.pgsql 
aws s3 cp census_historical_migration_eleceins.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_eleceins.pgsql
aws s3 cp census_historical_migration_elecauditfindings.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_elecauditfindings.pgsql
aws s3 cp census_historical_migration_eleccaptext.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_eleccaptext.pgsql
aws s3 cp census_historical_migration_elecfindingstext.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_elecfindingstext.pgsql
aws s3 cp census_historical_migration_elecnotes.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_elecnotes.pgsql
aws s3 cp census_historical_migration_elecpassthrough.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_elecpassthrough.pgsql
aws s3 cp census_historical_migration_elecauditheader.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_elecauditheader.pgsql
aws s3 cp census_historical_migration_elecaudits.pgsql s3://$PROD_BUCKET_NAME/census-historical/census_historical_migration_elecaudits.pgsql

cf delete-service-key "${PROD_SERVICE_INSTANCE_NAME}" "${PROD_KEY_NAME}"

cf t -s dev
#    Note: The above command switches you from Prod to Dev

exit
@gsa-suk gsa-suk changed the title Load census tables to Prod S3 Copy census tables to Prod S3 Sep 10, 2024
@jadudm
Copy link
Contributor

jadudm commented Sep 11, 2024

Uploads carried out along with RR as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants