s3-deploy | NodeJS bash utility for deploying files to Amazon S3 | Cloud Storage library
kandi X-RAY | s3-deploy Summary
kandi X-RAY | s3-deploy Summary
NodeJS bash utility for deploying files to Amazon S3
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of s3-deploy
s3-deploy Key Features
s3-deploy Examples and Code Snippets
Community Discussions
Trending Discussions on s3-deploy
QUESTION
I'm trying to use CDK and CodePipeline to build and deploy a React application to S3. After the CodePipeline
phase, in my own stack, I defined the S3 bucket like this:
ANSWER
Answered 2022-Jan-28 at 07:51For the first question:
And if I change to Source.asset("./build") I get the error: ... Why is it searching for the build directory on my machine?
This is happening when you run cdk synth
locally. Remember, cdk synth
will always reference the file system where this command is run. Locally it will be your machine, in the pipeline it will be in the container or environment that is being used by AWS CodePipeline.
Dig a little deeper into BucketDeployment
But also, there is some interesting things that happen here that could be helpful. BucketDeployment
doesn't just pull from the source you reference in BucketDeployment.sources
and upload it to the bucket you specify in BucketDeployment.destinationBucket
. According to the BucketDeployment docs the assets are uploaded to an intermediary bucket and then later merged to your bucket. This matters because it will explain your error received Error: Cannot find asset at C:\Users\pupeno\Code\ww3fe\build
because when you run cdk synth
it will expect the dir ./build
as stated in Source.asset("./build")
to exist.
This gets really interesting when trying to use a CodePipeline
to build and deploy a single page app like React in your case. By default, CodePipeline will execute a Source
step, followed a Synth
step, then any of the waves or stages you add after. Adding a wave that builds your react app won't work right away because we now see that the output directory of building you react app is needed during the Synth
step because of how BucketDeployment
works. We need to be able to have the order be Source -> Build -> Synth -> Deploy. As found in this question, we can control the order of the steps by using inputs and outputs. CodePipeline will order the steps to ensure input/output dependencies are met. So we need the have our Synth step use the Build's output as its input.
Concerns with the currently defined pipeline
I believe that your current pipeline is missing a CodeBuildStep
that would bundle your react app and output it to the directory that you specified in BucketDeployment.sources
. We also need to set the inputs to order these actions correctly. Below are some updates to the pipeline definition, though some changes may need to be made to have the correct file paths. Also, set BucketDeployment.sources
to the dir where your app bundle is written to.
QUESTION
I'm using Bitbucket pipelines to deploy my react app to the s3 bucket, deployments work fine but unfortunately, my process.env
variables are undefined. I already add my all env variables in deployment variables.
bitbucket-pipeline.yml
:
ANSWER
Answered 2022-Mar-02 at 13:41React runs in the user's web browser and therefore does not have access to environment variables running on the server. They are different environments.
You can embed environment variables in your app at build time:
Note: You must create custom environment variables beginning with
REACT_APP_
. Any other variables exceptNODE_ENV
will be ignored to avoid accidentally exposing a private key on the machine that could have the same name. Changing any environment variables will require you to restart the development server if it is running.
The "at build time" part of this is important. To include and use your REACT_APP_BASE_URL
variable in your app, make sure to define it in a way your "Build and Test" step can see.
Assuming you have defined that variable for the Production deployment environment, make sure to use that environment for the build step:
QUESTION
I've an Angular project on a Bitbucket repository. I created this pipeline that deploys the application on AWS S3 and invalidate the CloudFront distribution. Everything works fine. I would like to add the build number to the published version in order to know not just the version of the application but also the build that generated it.
...ANSWER
Answered 2022-Feb-08 at 11:15The Bitbucket Pipelines yml file is just running Bash/shell commands on a Linux Docker machine. So you can use the normal Bash commands, like sed and perl, to do a "find and replace" inside a JSON text file.
1. Generate the correct Regular ExpressionWe need to write an expression that will search the text in a file for "version": "dd.dd.dd"
and replace it with "version": "dd.dd.ddb123"
, where "d"
is a digit from 0-9
.
Use https://regex101.com to write and test a regex that does this. Here's a working expression and demo and an explanation: https://regex101.com/r/sRviUF/2
- Regular Expression:
("version".*:.*"\d.*(?="))
- Substitution:
${1}b123
Explanation:
(
and)
= Capture the found text as group 1, to use it as a substitution/replacement later"version".*:.*"
= Look for the string"version":"
with 0 or more spaces allowed before and after the colon:
\d.*(?=")
= Look for a single digit0-9
, then any characters. Then use a Positive Lookahead(?=")
to stop the capture before the next speech mark character"
${1}b123
= Replace with the captured group 1, then add a"b"
then add the numbers123
.
Test and practice on a Linux or MacOS Terminal, or use the Linux Bash Shell on Windows 10, or use an online Linux Terminal.
You will discover that the sed command cannot handle regexes with positive lookahead or negative lookahead, so we have to use perl
instead. We also need to simulate the BITBUCKET_BUILD_NUMBER
environment variable that is available on the Docker machine when the Pipeline is running.
QUESTION
I'm using CDK to deploy a CodePipeline that builds and deploys a React application to S3. All of that is working, but I want the deployment to update a domain name to point that S3 bucket.
I already have the Zone defined in Route53 but it is defined by a different cloud formation stack because there are a lot of details that are not relevant for this app (MX, TXT, etc). What's the right way for my Pipeline/Stacks to set those domain names?
I could think of two solutions:
- Delegate the domain to another zone, so zone
example.com
delegatesstaging.example.com
. - Have my pipeline inject records into the existing zone.
I didn't try the delegation zone method. I was slightly concerned about manually maintaining the generated nameservers from staging.example.com
into my CloudFormation for zone example.com
.
I did try injecting the records into the existing zone, but I run into some issues. I'm open to either solving these issues or doing this whichever way is correct.
In my stack (full pipeline at the bottom) I first define and deploy to the bucket:
...ANSWER
Answered 2022-Jan-31 at 16:31You cannot depend on CDK pipeline to fix itself if the synth stage is failing, since the Pipeline CloudFormation Stack is changed in the SelfMutate stage which uses the output of the synth stage. You will need to do one of the following options to fix your pipeline:
Run
cdk synth
andcdk deploy PipelineStack
locally (or anywhere outside the pipeline, where you have the required AWS IAM permissions). Edit: You will need to temporarily set selfMutatation tofalse
for this to work (Reference)Temporarily remove
route53.HostedZone.fromLookup
androute53.CnameRecord
from your MainStack while still keeping therolePolicyStatements
change. Commit and push your code, let CodePipeline run once, making sure that the Pipeline self mutates and the IAM role has the required additional permissions. Add back the route53 constructs, commit, push again and check whether your code works with the new changes.
QUESTION
I have deployed my website here:
...ANSWER
Answered 2022-Jan-17 at 09:09Your website doesn't feel like 100% (client side) static website. By that I mean every HTML page is pre-generated and everything is static on client side. If that's the case then /work/1
should not load any html page as it's not a html resource. For it to be HTML resource it should be like /work/1.html
With that being said, it looks like you're using React or some other technology which translates the routing when previous page is known. /
-> /work/1
As you have CloudFront already in your stack. Just set the error pages to redirect back to home page and then it should work fine. Attaching the solution for my react app hosted on S3+CloudFront.
QUESTION
I'm using bitbucket's pipeline to upload files to AWS S3. My bitbucket-pipelines.yml largely follows theis example here. However, I'm also using EXTRA_ARGS
param to specify several further options (excludes mostly), and I decided to also add there --metadata
like so:
ANSWER
Answered 2021-Dec-13 at 21:39If the problem has to do with JSON, you could try the aws sync --metadata Shorthand Syntax:
QUESTION
I want to create a userscript that will modify the way that a commit message is displayed in the Bitbucket Pipelines console, in a web browser.
So far, I have written the following JavaScript, which works fine on the Bitbucket "commits" page. It does two things:
- Enable line wrapping.
- set a 2-line height.
ANSWER
Answered 2021-Nov-14 at 14:26To simplify your scripts, you can use GM_addStyle
- a Tampermonkey's native method - to apply your CSS. However, if your scripts are just going to include a call to GM_addStyle
, then you should probably use an extension like Stylus.
For your first script, you can use pure CSS instead of attempting to get the element, fetch its class name, then apply some styles to that class.
Here's what I came up with:
QUESTION
I am trying to use one of our internal generated java library by JSII from Typescript aws-cdk-library project.
when we try to invoke and on cdk synth
we are getting below error
software.amazon.jsii.JsiiException: Module '@company/cdk-tags' not found Error: Module '@company/cdk-tags' not found
Currently we are using cdk version 1.106.0
, java 13 and maven 3.6.
here is our package.json and module-package.json
package.json
...ANSWER
Answered 2021-Jul-07 at 13:59Finally we are able to solve this issue. This was due to multiple modules with same java package structure names. This created a conflict in loading and finding the module when running from java.
After changing the package structure, it started working fine.
We have multiple modules like cloudwatch and nodejs-canary inside a main project.
Before
package.json for cloudwatch
"jsii": { "outdir": "dist", "targets": { "java": { "package": "com.company.common.aws.cdk", "maven": { "groupId": "com.company.common.aws.cdk", "artifactId": "cloudwatch" } } } }
package.json for nodejs-canary
"jsii": { "outdir": "dist", "targets": { "java": { "package": "com.company.common.aws.cdk", "maven": { "groupId": "com.company.common.aws.cdk", "artifactId": "nodejs-canary" } } } }
After
"jsii": { "outdir": "dist", "targets": { "java": { "package": "com.company.common.aws.cdk.cloudwatch", "maven": { "groupId": "com.company.common.aws.cdk", "artifactId": "cloudwatch" } } } }
package.json
"jsii": { "outdir": "dist", "targets": { "java": { "package": "com.company.common.aws.cdk.nodejs_canary", "maven": { "groupId": "com.company.common.aws.cdk", "artifactId": "nodejs-canary" } } } }
Just to add little more, initially when we ran with one module it worked fine. Later after adding additional modules while using in Java we got Module not found error.
QUESTION
I have a repo with the following files:
...ANSWER
Answered 2021-Jun-05 at 22:48QUESTION
Running my AWS CDK on Azure DevOps Pipeline, but getting this Cannot find module '@aws-cdk/cloud-assembly-schema'
error. No idea what goes wrong at the moment.
Run cdk synth myStack
The pipeline yml:
...ANSWER
Answered 2021-May-10 at 06:39You have to install the missing package for aws-cdk
before calling cdk synth myStack
.
run this command under pipeline task:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install s3-deploy
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page