Skip to content

Commit

Permalink
Merge pull request #25 from rrigato/dev
Browse files Browse the repository at this point in the history
extract cloudfront import details from readme
  • Loading branch information
rrigato authored Dec 10, 2023
2 parents d522dfb + 3343c32 commit 272e84b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 113 deletions.
78 changes: 2 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Personal website homepage.
- [install script](requirements/git_secrets.sh)


- Adhoc git secrets scan
- Scan before making repo public

```
git secrets --scan -r .
git secrets --scan-history
```


Expand All @@ -51,80 +51,6 @@ and tests static html/webpage configuration
- buildspec_prod.yml = Buildspec to use for the prod deployment CodeBuild project



#### devops

##### images
Repository for images that relate to resources for our code pipeline

#### legacy
awscli bash scripts used to import existing resources into
cloudformation templates.

Since the website implementation was originally created outside of
cloudformation

[List of resources that can be imported into cloudformation](
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-supported-resources.html
)

##### Prepare Existing CloudFront for migration

Documenting various one-time setup procedures that
were required when creating a new cloudfront distribution
via cloudformation because cloudformation resource import
does not support cloudfront

Get the existing CloudFront Distribution config via
the cli:

```
aws cloudfront get-distribution-config \
--id <distribution_id> > distribution_config_backup.json
```

Lower the default and max ttl (time to live ) json file from the get-distribution-config api call as you prepare to
change the distribution.

```
aws cloudfront update-distribution \
--id <distribution_id> \
--distribution-config file://<new_distribution_config.json>\
--if-match <ETag_value_returned_by_get_config>
```

Get the existing Route53 hosted zone and associated
record sets using the following cli command:

```
#hosted zone info
aws route53 get-hosted-zone \
--id <hosted_zone_id>
#record set info
aws route53 list-resource-record-sets
--hosted-zone-id <hosted_zone_id>
```

Note that the domain servers associated with your NS
and SOA record sets must match what is listed for the domain
names you own in Route53 "Registered Domains" listing.

You can create a new hosted zone for a subdomain
Ex:
example.com
test.example.com

Each having a distinct hosted zone, just the
NS and SOA record sets must match

#### logs
- directory for python log files





#### templates


Expand Down
40 changes: 40 additions & 0 deletions legacy/resources/cloudfront_import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#cloudfront distribution import config

aws cloudfront get-distribution-config \
--id <distribution_id> > distribution_config_backup.json


#Lower the default and max ttl (time to live )
#json file from the get-distribution-config api call as you prepare to
#change the distribution.


aws cloudfront update-distribution \
--id <distribution_id> \
--distribution-config file://<new_distribution_config.json>\
--if-match <ETag_value_returned_by_get_config>

# Get the existing Route53 hosted zone and associated
# record sets using the following cli command:


#hosted zone info
aws route53 get-hosted-zone \
--id <hosted_zone_id>

#record set info
aws route53 list-resource-record-sets
--hosted-zone-id <hosted_zone_id>


# Note that the domain servers associated with your NS
# and SOA record sets must match what is listed for the domain
# names you own in Route53 "Registered Domains" listing.

# You can create a new hosted zone for a subdomain
# Ex:
# example.com
# test.example.com

# Each having a distinct hosted zone, just the
# NS and SOA record sets must match
37 changes: 0 additions & 37 deletions templates/code_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,43 +346,6 @@ Resources:
RunOrder: 1



###############################
#stage 4 Builds the prod
# environment by populating resources created
# in stage 2
###############################
- Name: BuildProdEnvironment
Actions:
- Name: Test
######################################
#List of valid action type providers
#by action can be found here:
#https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#actions-valid-providers
######################################
ActionTypeId:
Category: Test
Owner: AWS
Version: '1'
Provider: CodeBuild
InputArtifacts:
- Name: !GetAtt GitRepo.Name
- Name: BuildDev
OutputArtifacts:
- Name: BuildProd
#########################################
#Configuration Details by provider can be found here:
#https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#structure-configuration-examples
#
#########################################
Configuration:
PrimarySource: !GetAtt GitRepo.Name
ProjectName:
!Join ['', ['prod-build-', !Ref ProjectName]]

RunOrder: 1


####################################
#Role that will be assumed when
#CodeBuild runs for dev
Expand Down

0 comments on commit 272e84b

Please sign in to comment.